public async Task <ActionResult> Edit([FromRoute] int id, [FromForm] MotherboardDtoViewModel motherboard) { var dto = _mapper.Map <MotherboardDtoViewModel, MotherboardUpdateDto>(motherboard); var result = await _motherboardsManagingService.UpdateMotherboardAsync(id, dto, HttpContext.GetJwtTokenFromCookie()); return(!result?RedirectToAction("ServerErrorIndex", "Error") : RedirectToAction("MotherboardsTable")); }
public async Task <ActionResult> Create([FromForm] MotherboardDtoViewModel motherboard) { var dto = _mapper.Map <MotherboardDtoViewModel, MotherboardInsertDto>(motherboard); var insertResult = await _motherboardsManagingService.CreateMotherboardAsync(dto, HttpContext.GetJwtTokenFromCookie()); if (insertResult) { return(RedirectToAction("MotherboardsTable")); } return(Problem()); }