public ActionResult Create([Bind(Include = "Id,Name,Abrv")] VehicleMakeViewModel vehicleMakeViewModel) { if (ModelState.IsValid) { _service.Add(vehicleMakeViewModel); return(RedirectToAction("Index")); } return(View(vehicleMakeViewModel)); }
public async Task <HttpResponseMessage> Add(VehicleMake vehicleMake) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid data")); } VehicleMakeServ vehicleMakeServ = mapper.Map <VehicleMakeServ>(vehicleMake); bool provjera = await VehicleMakeService.Add(vehicleMakeServ); if (provjera) { return(Request.CreateResponse(HttpStatusCode.OK, "Vehicle make is successfuly created!")); } else { return(Request.CreateResponse(HttpStatusCode.Conflict, "Vehicle make is not created!")); } }