public ActionResult Create([Bind(Include = "Id,Name,Abrv,Make_Id")] VehicleModelViewModel vehicleModelViewModel)
        {
            if (ModelState.IsValid)
            {
                vehicleModelViewModel.Id = Guid.NewGuid();
                _serviceModel.Add(vehicleModelViewModel);
                return(RedirectToAction("Index"));
            }

            return(View(vehicleModelViewModel));
        }
        public async Task <HttpResponseMessage> Add(VehicleModel vehicleModel)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid data"));
            }

            VehicleModelServ vehicleModelServ = mapper.Map <VehicleModelServ>(vehicleModel);
            bool             provjera         = await VehicleModelService.Add(vehicleModelServ);

            if (provjera)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Vehicle model is successfully created!"));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Conflict, "Vehicle model is not created!"));
            }
        }
 public ActionResult Create(VehicleModel vehicleModel)
 {
     try
     {
         if (vehicleModel.Name == null)
         {
             ViewBag.Response = Domain.DTOs.Response.Fail("Adı alanı boş bırakılamaz");
             return(View());
         }
         var response = VehicleModelService.Add(vehicleModel);
         ViewBag.Response = response;
     }
     catch
     {
         ViewBag.Response = Domain.DTOs.Response.Fail("Bir Hata oluştu");
     }
     finally
     {
         ViewBag.VehicleBrands = GetVehicleBrand();
     }
     return(View());
 }