public void CreateRole(RoleModel role)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();
            Role obj = new Role();

            ObjectHelper.CopyProperties(role, obj);
            ent.AddToRole(obj);
            ent.SaveChanges();

            role.ID = obj.ID;
        }
        public void UpdateCompanySetting(CompanySettingModel companySetting)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.CompanySetting
                        select i;

            var obj = query.FirstOrDefault();

            ObjectHelper.CopyProperties(companySetting, obj);
            ent.SaveChanges();
        }
        public void DeleteRoleDetails(long roleID)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.RoleDetail
                        where i.RoleID == roleID
                        select i;

            foreach (var obj in query.AsEnumerable())
            {
                ent.DeleteObject(obj);
            }

            ent.SaveChanges();
        }
        public void CreateRoleDetails(int roleID, List <RoleDetailModel> roleDetailList)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            foreach (var roleDetail in roleDetailList)
            {
                roleDetail.RoleID = roleID;

                RoleDetail obj = new RoleDetail();
                ObjectHelper.CopyProperties(roleDetail, obj);
                ent.AddToRoleDetail(obj);
            }

            ent.SaveChanges();
        }