public ActionResult Edit(VehicleModel vehicleModel)
 {
     try
     {
         Response response = VehicleModelService.Update(vehicleModel);
         ViewBag.Response = response;
     }
     catch
     {
         ViewBag.Response = Domain.DTOs.Response.Fail("Bir Hata oluştu");
     }
     finally
     {
         ViewBag.VehicleBrands = GetVehicleBrand();
     }
     return(View(vehicleModel));
 }
Ejemplo n.º 2
0
        public async Task <HttpResponseMessage> Update(VehicleModel vehicleModel)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid data"));
            }

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

            if (provjera)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Vehicle model is successfully updated!"));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Conflict, "Vehicle model is not updated!"));
            }
        }