private List<UserProfileDetailModel> datafunc() { var listdata = new List<UserProfileDetailModel>(); foreach (var row in RadGridProfile.Rows) { if (((bool)row.Cells["CreateStatus"].Value == true) || ((bool)row.Cells["EditStatus"].Value == true) || ((bool)row.Cells["DeleteStatus"].Value == true) || ((bool)row.Cells["PrintStatus"].Value == true) || ((bool)row.Cells["ViewStatus"].Value == true)) { var tempdata = new UserProfileDetailModel() { ProfileId = ProfileId, ModuleId = (int)row.Cells["ModuleId"].Value, CreateStatus = Convert.ToBoolean(row.Cells["CreateStatus"].Value), EditStatus = Convert.ToBoolean(row.Cells["EditStatus"].Value), DeleteStatus = Convert.ToBoolean(row.Cells["DeleteStatus"].Value), PrintStatus = Convert.ToBoolean(row.Cells["PrintStatus"].Value), ViewStatus = Convert.ToBoolean(row.Cells["ViewStatus"].Value), }; listdata.Add(tempdata); } } return listdata; }
public int saveUserProfileDetail(UserProfileDetailModel model) { try { using (_context= new HSSNInventoryEntities() ) { var data = new UserProfileDetail() { ProfileId = model.ProfileId, ModuleId = model.ModuleId, CreateStatus = model.CreateStatus, EditStatus = model.EditStatus, DeleteStatus = model.DeleteStatus, PrintStatus = model.PrintStatus, ViewStatus = model.ViewStatus }; _context.Entry(data).State=EntityState.Added; _context.SaveChanges(); return data.ProfileDetailId; } } catch (Exception) { throw; } }