// GET: Pricing/Details/5 public async Task <ActionResult> Details(Guid id) { var price = new PricingDetailsViewModel(); try { var result = await _pricingService.FindById(id); if (!result.Success) { Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View(price)); } price.Code = result.Data.Code; price.Id = result.Data.Id; price.Price = result.Data.Price; price.Product = result.Data.Product.Name; price.Tier = result.Data.Tier.Name; price.DateCreated = result.Data.CreatedAt; price.DateLastUpdated = result.Data.LastUpdated; return(View(price)); } catch (Exception ex) { Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View(price)); } }
public async Task <ActionResult> Delete(Guid id, PricingDetailsViewModel request) { if (!ModelState.IsValid) { Alert("Bad Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } if (id == null) { Alert($"Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } try { var result = await _pricingService.Delete(id); if (!result.Success) { Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } Alert($"Pricing Deleted 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()); } }