public MoistureSettings Update(MoistureSettings model)
        {
            var entity = dbContext.MoistureSettings.Find(model.MoistureSettingsId);

            if (entity == null)
            {
                entity = model;
                return(Create(entity));
            }
            else
            {
                entity.M1           = model.M1; entity.M2 = model.M2;
                entity.M3           = model.M3; entity.M4 = model.M4;
                entity.D1           = model.D1; entity.D2 = model.D2;
                entity.D3           = model.D3; entity.D4 = model.D4;
                entity.I1           = model.I1; entity.I2 = model.I2;
                entity.I3           = model.I3; entity.I4 = model.I4;
                entity.DeductFromPO = model.DeductFromPO;
                entity.AllowableOT  = model.AllowableOT;
                entity.AllowablePM  = model.AllowablePM;
                dbContext.SaveChanges();
            }
            return(entity);
        }
 public bool ValidateCode(MoistureSettings model)
 {
     throw new NotImplementedException();
 }
 public SqlRawParameter GetSqlRawParameter(MoistureSettings parameters)
 {
     throw new NotImplementedException();
 }
 public bool Delete(MoistureSettings model)
 {
     dbContext.MoistureSettings.Remove(model);
     dbContext.SaveChanges();
     return(true);
 }
 public IQueryable <MoistureSettings> Get(MoistureSettings model = null)
 {
     return(dbContext.MoistureSettings.AsNoTracking().AsQueryable());
 }
 public List <SqlParameter> CreateSQLParameters(MoistureSettings parameters)
 {
     throw new NotImplementedException();
 }
 public string CreateSelecteQuery(MoistureSettings parameters)
 {
     throw new NotImplementedException();
 }
 public MoistureSettings Create(MoistureSettings model)
 {
     dbContext.MoistureSettings.Add(model);
     dbContext.SaveChanges();
     return(model);
 }
 public IActionResult Put([FromBody] MoistureSettings model)
 {
     return(Ok(repository.Update(model)));
 }
 public void Post([FromBody] MoistureSettings model)
 {
     repository.Create(model);
 }