public ActionResult Index(OutStation outStation)
        {
            try
            {
                var station = new Station
                {
                    Name        = outStation.Name,
                    Location    = outStation.Location,
                    Contact     = outStation.Contact,
                    DisplayName = outStation.DisplayName,
                    Deleted     = 0,
                    CreateDate  = outStation.CreateDate
                };

                if (_stationRepository.AddStation(station) > 0)
                {
                    var returnData = new ReturnData
                    {
                        HasValue = true,
                        Message  = "Station was successfully created"
                    };
                    TempData["returnMessage"] = returnData;
                    return(Redirect("Station"));
                }
            }
            catch (Exception e)
            {
                var returnData = new ReturnData
                {
                    HasValue = true,
                    Message  = "There was an error saving the station"
                };
                TempData["returnMessage"] = returnData;
                return(Redirect("Station"));
            }

            return(View());
        }
Exemplo n.º 2
0
        public bool AddStation(Station NewStation)
        {
            var StationAdded = _repository.AddStation(NewStation);

            return(StationAdded);
        }
 public bool AddStation(RepositoryModelStation station)
 {
     return(_stationRepository.AddStation(station));
 }