
namespace SilverlightDataApp.Web
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Web.Ria;
    using System.Web.Ria.Data;
    using System.Web.DomainServices;
    using System.Data;
    using System.Web.DomainServices.LinqToEntities;


    // Implements application logic using the PeopleDBEntities context.
    // TODO: Add your application logic to these methods or in additional methods.
    [EnableClientAccess()]
    public class MyDomainService : LinqToEntitiesDomainService<PeopleDBEntities>
    {

        // TODO: Consider
        // 1. Adding parameters to this method and constraining returned results, and/or
        // 2. Adding query methods taking different parameters.
        public IQueryable<RegTable> GetRegTable()
        {
            return this.Context.RegTable;
        }

        public void InsertRegTable(RegTable regTable)
        {
            this.Context.AddToRegTable(regTable);
        }

        public void UpdateRegTable(RegTable currentRegTable, RegTable originalRegTable)
        {
            this.Context.AttachAsModified(currentRegTable, originalRegTable);
        }

        public void DeleteRegTable(RegTable regTable)
        {
            if ((regTable.EntityState == EntityState.Detached))
            {
                this.Context.Attach(regTable);
            }
            this.Context.DeleteObject(regTable);
        }
    }
}


