public void Add(FloorViewModel model) { var entity = new HMS_Floor { FloorName = model.FloorName, Active = true }; _genericRepository.Add(entity); }
public void Edit(FloorViewModel model) { var entity = new HMS_Floor { FloorName = model.FloorName, Active = model.Active, Id = model.Id }; _genericRepository.Edit(entity); }
public bool CheckDuplicate(HMS_Floor floor) { PMSEntities dbContext = new PMSEntities(); List <HMS_Floor> checkUnique; if (floor.Id > 0) { checkUnique = (from d in dbContext.HMS_Floor where (d.FloorName == floor.FloorName) && (d.Id != floor.Id) select d).ToList(); } else { checkUnique = (from d in dbContext.HMS_Floor where d.FloorName == floor.FloorName select d).ToList(); } return(checkUnique.Count > 0 ? true : false); }