public bool SaveUserProfileDetaile(List<UserProfileDetailModel> modellist) { try { using (_context= new HSSNInventoryEntities() ) { foreach (var userProfileDetailModel in modellist) { var model = new UserProfileDetail() { ProfileId = userProfileDetailModel.ProfileId, ModuleId = userProfileDetailModel.ModuleId, CreateStatus = userProfileDetailModel.CreateStatus, EditStatus = userProfileDetailModel.EditStatus, DeleteStatus = userProfileDetailModel.DeleteStatus, PrintStatus = userProfileDetailModel.PrintStatus, ViewStatus = userProfileDetailModel.ViewStatus, }; _context.Entry(model).State=EntityState.Added; } _context.SaveChanges(); return true; } } catch (Exception e) { Console.WriteLine(e); throw; } }
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; } }