public bool Insert(LaboratoryRequestType newLaboratoryRequestType)
 {
     using (MySqlHealthContext ctx = new MySqlHealthContext())
     {
         ctx.LaboratoryRequestTypes.Add(newLaboratoryRequestType);
         return(ctx.SaveChanges() > -1);
     }
 }
 public bool Delete(int id)
 {
     using (MySqlHealthContext ctx = new MySqlHealthContext())
     {
         LaboratoryRequestType laboratoryRequestType = ctx.LaboratoryRequestTypes.FirstOrDefault(d => d.Id == id);
         if (laboratoryRequestType == null)
         {
             return(false);
         }
         ctx.LaboratoryRequestTypes.Remove(laboratoryRequestType);
         return(ctx.SaveChanges() > -1);
     }
 }
        public bool Update(LaboratoryRequestType newInfoLaboratoryRequestType)
        {
            using (MySqlHealthContext ctx = new MySqlHealthContext())
            {
                LaboratoryRequestType laboratoryRequestType =
                    ctx.LaboratoryRequestTypes.FirstOrDefault(d => d.Id == newInfoLaboratoryRequestType.Id);
                if (laboratoryRequestType == null)
                {
                    return(false);
                }

                laboratoryRequestType.Name = newInfoLaboratoryRequestType.Name;
                laboratoryRequestType.Min  = newInfoLaboratoryRequestType.Min;
                laboratoryRequestType.Max  = newInfoLaboratoryRequestType.Max;
                laboratoryRequestType.LaboratoryItemUnitId = newInfoLaboratoryRequestType.LaboratoryItemUnitId;
                laboratoryRequestType.IsActive             = newInfoLaboratoryRequestType.IsActive;
                return(ctx.SaveChanges() > -1);
            }
        }
コード例 #4
0
 public bool Update(LaboratoryRequestType newInfoLaboratoryRequestType)
 {
     return(_laboratoryRequestTypeDal.Update(newInfoLaboratoryRequestType));
 }
コード例 #5
0
 public bool Insert(LaboratoryRequestType newLaboratoryRequestType)
 {
     return(_laboratoryRequestTypeDal.Insert(newLaboratoryRequestType));
 }