public ZoneViewModel SetRecordinEdit(tblZonemaster tblZone) { ZoneViewModel zone = new ZoneViewModel(); zone.ID = tblZone.ZoneID; zone.ZoneName = tblZone.Zone; return(zone); }
public void SaveUpdateRecord(ZoneViewModel model) { tblZonemaster tblZone = new tblZonemaster(); if (model.ID <= 0) { model.ID = _context.tblZonemasters.Any() ? _context.tblZonemasters.Max(x => x.ZoneID) + 1 : 1; tblZone.ZoneID = model.ID; _context.tblZonemasters.Add(tblZone); } else { tblZone = _context.tblZonemasters.Where(x => x.ZoneID == model.ID).FirstOrDefault(); } tblZone.Zone = model.ZoneName; _context.SaveChanges(); }
public ZoneViewModel SetDataOnEdit(tblZonemaster tblZone) { var item = _zoneRepository.SetRecordinEdit(tblZone); return(item); }