public async Task <ResponseCRUDMessage> Update(Cars car) { var response = new ResponseCRUDMessage(false, ""); var carExist = carsRepository.FindById(car.Id); if (carExist == null) { response.message = "The car not exist!"; return(response); } carExist = car; try { response.status = await carsRepository.Update(carExist); if (response.status) { response.message = "The car was updated!"; } else { return(null); } } catch (Exception ex) { response.message = ex.Message; } return(response); }
public ActionResult Edit(int id, MobileBrand entity) { try { _brand.Update(entity); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(int id, ProductDetails entity) { try { _product.Update(entity); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(int id, string Brand, ProductDetails entity) { try { entity.BrandId = Convert.ToInt32(Brand); _product.Update(entity); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public IActionResult Put(int id, [FromBody] CountyDTO model) { try { var beforeObject = _repo.Counties(id); if (beforeObject == null) { return(NotFound()); } _mapper.Map(model, beforeObject); _repo.Update(beforeObject); return(Ok(_mapper.Map <CountyDTO>(beforeObject))); } catch { return(BadRequest()); } }