Ejemplo n.º 1
0
        public void Update(PollingStations pollingStationParam)
        {
            var pollingStation = _context.PollingStations.Find(pollingStationParam.Id);

            if (pollingStation == null)
            {
                throw new AppException("User not found");
            }


            // update user properties
            pollingStation.ArabicName             = pollingStationParam.ArabicName;
            pollingStation.Latitude               = pollingStationParam.Latitude;
            pollingStation.Longitude              = pollingStationParam.Longitude;
            pollingStation.WilayatCode            = pollingStationParam.WilayatCode;
            pollingStation.Name                   = pollingStationParam.Name;
            pollingStation.IsActive               = pollingStationParam.IsActive;
            pollingStation.IsUnifiedPollingCenter = pollingStationParam.IsUnifiedPollingCenter;
            _context.PollingStations.Update(pollingStation);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
 public PollingStations Create(PollingStations pollingStations)
 {
     _context.PollingStations.Add(pollingStations);
     _context.SaveChanges();
     return(pollingStations);
 }