コード例 #1
0
 public bool Insert(LaboratoryItemUnit newLaboratoryItemUnit)
 {
     using (MySqlHealthContext ctx = new MySqlHealthContext())
     {
         ctx.LaboratoryItemUnits.Add(newLaboratoryItemUnit);
         return(ctx.SaveChanges() > -1);
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 public bool Update(LaboratoryItemUnit newInfoLaboratoryItemUnit)
 {
     return(_laboratoryItemUnitDal.Update(newInfoLaboratoryItemUnit));
 }
コード例 #5
0
 public bool Insert(LaboratoryItemUnit newLaboratoryItemUnit)
 {
     return(_laboratoryItemUnitDal.Insert(newLaboratoryItemUnit));
 }