Пример #1
0
        public ZoneViewModel SetRecordinEdit(tblZonemaster tblZone)
        {
            ZoneViewModel zone = new ZoneViewModel();

            zone.ID       = tblZone.ZoneID;
            zone.ZoneName = tblZone.Zone;
            return(zone);
        }
Пример #2
0
        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();
        }
Пример #3
0
        public ZoneViewModel SetDataOnEdit(tblZonemaster tblZone)
        {
            var item = _zoneRepository.SetRecordinEdit(tblZone);

            return(item);
        }