// GET: Tier/Details/5 public async Task <ActionResult> Details(Guid id) { var tier = new TierDetailsViewModel(); try { var result = await _tierService.FindById(id); if (!result.Success) { Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View(tier)); } tier.Code = result.Data.Code; tier.Id = result.Data.Id; tier.Name = result.Data.Name; tier.Description = result.Data.Description; tier.DateCreated = result.Data.CreatedAt; tier.DateLastUpdated = result.Data.LastUpdated; return(View(tier)); } catch (Exception ex) { Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View(tier)); } }
public async Task <ActionResult> Delete(Guid id, TierDetailsViewModel 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 _tierService.Delete(id); if (!result.Success) { Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } Alert($"Tier 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()); } }