public async Task <IActionResult> EditReturnPost(ICollection <IFormFile> returnFiles, DeliveryItemReturnVM model, string filterJson) { ViewBag.filterJson = filterJson; if (!ModelState.IsValid) { return(View(nameof(Edit), model)); } var currentId = model.Id; (bool saveResult, int notificationId) = await notificationService.DeliveryItemSaveReturn(model, returnFiles); if (saveResult) { this.SaveLogOperation(currentId == 0, model.Id); SetSuccessMessage(MessageConstant.Values.SaveOK); if (filterJson == null) { return(RedirectToAction("Edit", "CaseNotification", new { id = notificationId })); } else { ModelState.Clear(); return(Index(filterJson)); } } else { if (filterJson == null) { var delivery = service.GetById <DeliveryItem>(model.Id); int notificationIdErr = delivery.CaseNotificationId ?? 0; ViewBag.breadcrumbs = commonService.Breadcrumbs_ForCaseNotificationEditReturn(notificationIdErr).DeleteOrDisableLast(); } else { int filterType = getFilterTypeFromJson(filterJson); ViewBag.breadcrumbs = commonService.Breadcrumbs_ForDeliveryItemEditReturn(filterType, model.Id).DeleteOrDisableLast(); } SetViewbag(-1); SetErrorMessage(MessageConstant.Values.SaveFailed); return(View(nameof(EditReturn), model)); } }