Пример #1
0
        public ActionResult AddParkingSpot(ParkingSpotViewModel model)
        {
            var parkingFloor = parkingFloorService.Get(model.ParkingFloorId);

            if (parkingFloor != null)
            {
                ParkingSpot parkingSpotEntity = new ParkingSpot
                {
                    AddedDate      = DateTime.UtcNow,
                    ModifiedDate   = DateTime.UtcNow,
                    ParkingFloorId = model.ParkingFloorId
                };

                parkingSpotService.InsertParkingSpot(parkingSpotEntity);
                if (parkingSpotEntity.Id > 0)
                {
                    return(RedirectToAction("index"));
                }
                return(View(model));
            }
            else
            {
                TempData["NoFloorMessage"] = "The Floor does not exist";
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult DeleteParkingFloor(int id)
        {
            ParkingFloor parkingFloor = parkingFloorService.Get(id);
            string       name         = $"{parkingFloor.Id}";

            return(View("DeleteParkingFloor", name));
        }