public void Edit([FromBody] TrayType trayType) { if (ModelState.IsValid) { objtraytype.UpdateTrayType(trayType); } }
public void Create([FromBody] TrayType trayType) { if (ModelState.IsValid) { objtraytype.AddTrayType(trayType); } }
//Get the details of a particular tray public TrayType GetTrayTypeData(int id) { try { TrayType trayType = db.tblTrayType.Find(id); return(trayType); } catch { throw; } }
//To Update the records of a particluar tray public void UpdateTrayType(TrayType trayType) { try { db.Entry(trayType).State = EntityState.Modified; db.SaveChanges(); } catch { throw; } }
//To Add new tray record public void AddTrayType(TrayType trayType) { try { db.tblTrayType.Add(trayType); db.SaveChanges(); } catch { throw; } }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 4, Configuration.FieldSeparator), Id, TrayType?.ToDelimitedString(), ServicePeriod != null ? string.Join(Configuration.FieldRepeatSeparator, ServicePeriod.Select(x => x.ToDelimitedString())) : null, TextInstruction ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
//To Delete the record of a particular tray public void DeleteTrayType(int id) { try { TrayType trayType = db.tblTrayType.Find(id); db.tblTrayType.Remove(trayType); db.SaveChanges(); } catch { throw; } }