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