Beispiel #1
0
        public ServiceResult Post(CarParkingSpace model)
        {
            var result = new ServiceResult {
                IsSuccess = true
            };

            model.Status = false;
            context.CarParkingSpaces.Add(model);
            context.SaveChanges();
            return(result);
        }
 public ActionResult CreateOrUpdate(CarParkingSpace model)
 {
     if (model.Id == 0)
     {
         var data = parkingSpaceService.Post(model);
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
     else
     {
         var data = parkingSpaceService.Put(model);
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
 }
Beispiel #3
0
        public ServiceResult Put(CarParkingSpace model)
        {
            var result = new ServiceResult {
                IsSuccess = false
            };
            var data = context.CarParkingSpaces.FirstOrDefault(x => x.Id == model.Id);

            if (data != null && model != null)
            {
                data.ParkingSpaces = model.ParkingSpaces;
                context.SaveChanges();
                result.IsSuccess = true;
            }
            return(result);
        }
Beispiel #4
0
        public void Table()
        {
            Park park = new Park();

            Console.WriteLine(park);
            Park.Table();
            Console.WriteLine();
            Console.Write("Please enter the row ");
            int row = int.Parse(Console.ReadLine());

            Console.Write($"Please enter the column ");
            int column = int.Parse(Console.ReadLine());

            parking[row, column] = new CarParkingSpace();
        }