public async Task <ActionResult <Buyer> > Put([FromBody] Buyer buyer) { try { await _buyerManager.Update(buyer); return(Ok(buyer)); } catch (Exception exception) { _logger.LogError($"Error occured during updating buyer. Exception: {exception.Message}"); return(BadRequest()); } }
public async Task <IActionResult> Edit(BuyerViewModel buyerViewModel) { try { var buyer = _mapper.Map <BuyerViewModel, Buyer>(buyerViewModel); await _buyerManager.Update(buyer); return(RedirectToAction("Index", "Products")); } catch (Exception exception) { _logger.LogError($"Error occured during updating buyer. Exception: {exception.Message}"); return(View(buyerViewModel)); } }