public async Task <ActionResult> Edit(Guid id, EditPackagingViewModel request) { if (!ModelState.IsValid) { Alert("Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } if (!id.Equals(request.Id)) { Alert("Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } try { var packagingUpdateRequest = new UpdatePackagingRequest { Id = request.Id, Name = request.Name, Description = request.Description }; var result = await _packagingService.Update(id, packagingUpdateRequest); if (!result.Success) { Alert($"Error: {result.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } Alert($"Packaging Updated Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(Index))); } catch { Alert($"Error Occurred While processing the request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } }