public void PassengerProcessor() { var np = new PassengerProcessor(); var res = np.ProcessPNL(SystemConstants.GetTestPNL()); Assert.AreEqual(res.Count, 3); Assert.AreEqual(res["LVGVUP"].Count, 2); Assert.AreEqual(res["LVK6HA"].Count, 1); }
public IActionResult GetAllPassenger(string loginAccount) { try { if (!string.IsNullOrEmpty(loginAccount)) { using (PassengerProcessor processor = new PassengerProcessor(_applicationDbContext)) { List <Passengers> lstpassengers = processor.GetAllPassenger(loginAccount); if (lstpassengers.Count > 0) { return(Ok(new Application_ResponseWrapper() { ResponseCode = "0", ResponseMessage = "success", Status = "success", ResponseResult = lstpassengers })); } else { return(Ok(new Application_ResponseWrapper() { ResponseCode = "1004", ResponseMessage = "Result not found", Status = "failed" })); } } } else { return(Ok(new Application_ResponseWrapper() { ResponseCode = "1000", ResponseMessage = "Invalid model", Status = "failed" })); } } catch (Exception ex) { _errorRepository. Add(new Application_Errors { applicationID = 1, errorDescription = ex.ToString(), errorType = "Exception", logDate = System.DateTime.Now, pageID = 0, Source = "Mpower/Rail/Passenger/GetAllPassenger" }); _errorRepository.Commit(); return(Ok(new Application_ResponseWrapper() { ResponseCode = "1005", ResponseMessage = "An error has occured", Status = "failed" })); } }
public IActionResult UpdatePassenger(long passengerId) { try { if (ModelState.IsValid) { using (PassengerProcessor processor = new PassengerProcessor(_applicationDbContext)) { bool status = processor.DeletePassenger(passengerId); if (status) { return(Ok(new Application_ResponseWrapper() { ResponseCode = "0", ResponseMessage = "success", Status = "success", ResponseResult = "Passenger Deleted." })); } else { return(Ok(new Application_ResponseWrapper() { ResponseCode = "1000", ResponseMessage = "Invalid model", Status = "failed", ResponseResult = "Invalid Passenger Id" })); } } } else { return(Ok(new Application_ResponseWrapper() { ResponseCode = "1000", ResponseMessage = "Invalid model", Status = "failed" })); } } catch (Exception ex) { _errorRepository. Add(new Application_Errors { applicationID = 1, errorDescription = ex.ToString(), errorType = "Exception", logDate = System.DateTime.Now, pageID = 0, Source = "Mpower/Rail/Passenger/DeletePassenger" }); _errorRepository.Commit(); return(Ok(new Application_ResponseWrapper() { ResponseCode = "1005", ResponseMessage = "An error has occured", Status = "failed" })); } }
public Dictionary <String, List <String> > Post([FromBody] List <String> value) { var res = new Dictionary <String, List <String> >(); if (value == null || value.Count == 0) { res.Add("Error", new List <string> { "Invalid value" }); } var result = new PassengerProcessor().ProcessPNL(value); return(result); }
public IActionResult CreatePassenger([FromBodyAttribute] Passenger req) { try { if (ModelState.IsValid) { using (PassengerProcessor processor = new PassengerProcessor(_applicationDbContext)) { Passengers _passenger = processor.CreatePassenger(req); return(Ok(new Application_ResponseWrapper() { ResponseCode = "0", ResponseMessage = "success", Status = "success", ResponseResult = _passenger })); } } else { return(Ok(new Application_ResponseWrapper() { ResponseCode = "1000", ResponseMessage = "Invalid model", Status = "failed" })); } } catch (Exception ex) { _errorRepository. Add(new Application_Errors { applicationID = 1, errorDescription = ex.ToString(), errorType = "Exception", logDate = System.DateTime.Now, pageID = 0, Source = "Mpower/Rail/Passenger/CreatePassenger" }); _errorRepository.Commit(); return(Ok(new Application_ResponseWrapper() { ResponseCode = "1005", ResponseMessage = "An error has occured", Status = "failed" })); } }