public bool Insert(LaboratoryItemUnit newLaboratoryItemUnit) { using (MySqlHealthContext ctx = new MySqlHealthContext()) { ctx.LaboratoryItemUnits.Add(newLaboratoryItemUnit); return(ctx.SaveChanges() > -1); } }
public bool Delete(int id) { using (MySqlHealthContext ctx = new MySqlHealthContext()) { LaboratoryItemUnit laboratoryItemUnit = ctx.LaboratoryItemUnits.FirstOrDefault(d => d.Id == id); if (laboratoryItemUnit == null) { return(false); } ctx.LaboratoryItemUnits.Remove(laboratoryItemUnit); return(ctx.SaveChanges() > -1); } }
public bool Update(LaboratoryItemUnit newInfoLaboratoryItemUnit) { using (MySqlHealthContext ctx = new MySqlHealthContext()) { LaboratoryItemUnit laboratoryItemUnit = ctx.LaboratoryItemUnits.FirstOrDefault(d => d.Id == newInfoLaboratoryItemUnit.Id); if (laboratoryItemUnit == null) { return(false); } laboratoryItemUnit.Name = newInfoLaboratoryItemUnit.Name; laboratoryItemUnit.IsActive = newInfoLaboratoryItemUnit.IsActive; return(ctx.SaveChanges() > -1); } }
public bool Update(LaboratoryItemUnit newInfoLaboratoryItemUnit) { return(_laboratoryItemUnitDal.Update(newInfoLaboratoryItemUnit)); }
public bool Insert(LaboratoryItemUnit newLaboratoryItemUnit) { return(_laboratoryItemUnitDal.Insert(newLaboratoryItemUnit)); }