public async Task <IActionResult> Active(ProductIdRequestModel request) { if (!ModelState.IsValid) { return(RedirectToErrorPage()); } var isActived = await _productService.ActiveAsync(new ProductModifyRequest { Id = request.Id, UpdatedById = LoggedUserId }); if (!isActived) { return(RedirectToErrorPage()); } if (request.ShouldKeepUpdatePage) { return(RedirectToAction(nameof(Update), new { id = request.Id })); } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Delete(ProductIdRequestModel request) { if (!ModelState.IsValid) { return(RedirectToErrorPage()); } var isDeleted = await _productService.DeleteAsync(request.Id); if (!isDeleted) { return(RedirectToErrorPage()); } return(RedirectToAction(nameof(Index))); }