Example #1
0
 public IActionResult TdrDetails(string RoId)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(RoId.ToString()))
         {
             return(Ok(new Application_ResponseWrapper()
             {
                 ResponseCode = "1000", ResponseMessage = "Invalid model", Status = "failed"
             }));
         }
         using (ITdrProcessor _tdrProcessor = new TdrProcessor(_applicationDbContext))
         {
             var tdrs = _tdrProcessor.GetTdrDetailList(RoId.ToString());
             if (tdrs == null)
             {
                 return(Ok(new Application_ResponseWrapper()
                 {
                     ResponseCode = "1004", ResponseMessage = "Record not found", Status = "failed"
                 }));
             }
             return(Ok(new Application_ResponseWrapper()
             {
                 ResponseCode = "0", ResponseMessage = "success", Status = "success", ResponseResult = tdrs
             }));
         }
     }
     catch (Exception ex)
     {
         _errorRepository.
         Add(new Application_Errors
         {
             applicationID    = 1,
             errorDescription = ex.StackTrace,
             errorType        = "Exception",
             logDate          = System.DateTime.Now,
             pageID           = 0,
             Source           = "Mpower/Rail/History/TDR/Details"
         });
         _errorRepository.Commit();
         return(Ok(new Application_ResponseWrapper()
         {
             ResponseCode = "1005", ResponseMessage = "An error has occured", Status = "failed"
         }));
     }
 }
Example #2
0
 public IActionResult GetTdrReasons()
 {
     try
     {
         using (ITdrProcessor _tdrProcessor = new TdrProcessor(_applicationDbContext))
         {
             var reasonsList = _tdrProcessor.GetTdrReasonsList();
             if (reasonsList.Count == 0)
             {
                 return(Ok(new Application_ResponseWrapper()
                 {
                     ResponseCode = "1004", ResponseMessage = "Record not found", Status = "failed"
                 }));
             }
             return(Ok(new Application_ResponseWrapper()
             {
                 ResponseCode = "0", ResponseMessage = "success", Status = "success", ResponseResult = reasonsList
             }));
         }
     }
     catch (Exception ex)
     {
         _errorRepository.
         Add(new Application_Errors
         {
             applicationID    = 1,
             errorDescription = ex.StackTrace,
             errorType        = "Exception",
             logDate          = System.DateTime.Now,
             pageID           = 0,
             Source           = "Mpower/Rail/History/TDR/Reasons"
         });
         _errorRepository.Commit();
         return(Ok(new Application_ResponseWrapper()
         {
             ResponseCode = "1005", ResponseMessage = "An error has occured", Status = "failed"
         }));
     }
 }