コード例 #1
0
        public IActionResult AddVehicleMake(VehicleMakeJsonModel model)
        {
            bool isAdded = false;

            if (!string.IsNullOrEmpty(model.Name))
            {
                model.Name = model.Name.Trim();
                isAdded    = _vehicleService.AddMake(model);
            }
            string error = isAdded ? Messages.INFO_ENTITY_ADDED : Messages.ERROR_ENTITY_EXISTS;

            return(Json(new ResponseJsonModel(isAdded, error: error)));
        }
コード例 #2
0
        public ActionResult Create(VehicleMakeVM obj)
        {
            if (ModelState.IsValid)
            {
                string str = repository.AddMake(obj);
                if (str == "Ok")
                {
                    return(RedirectToAction("Index"));
                }
                return(View()); // open error page
            }

            else
            {
                return(View());
            }
        }
コード例 #3
0
ファイル: MakeController.cs プロジェクト: mallek/VehicleTest
 public ActionResult Create(VehicleMake vehicleMake)
 {
     vehicleMake.MakeId = _vehicleService.AddMake(vehicleMake);
     return(View());
 }