public Task <TripPerson> CreateAsync(TripPerson value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(DataInvoker.Default.InvokeAsync(this, async() => { TripPerson __result; var __dataArgs = ODataMapper.Default.CreateArgs(); if (_createOnBeforeAsync != null) { await _createOnBeforeAsync(value, __dataArgs).ConfigureAwait(false); } __result = await TripOData.Default.CreateAsync(__dataArgs, value).ConfigureAwait(false); if (_createOnAfterAsync != null) { await _createOnAfterAsync(__result).ConfigureAwait(false); } return __result; }, new BusinessInvokerArgs { ExceptionHandler = _createOnException })); }
public async Task <TripPerson> CreateAsync(TripPerson value) => await ManagerInvoker.Current.InvokeAsync(this, async() => { await value.Validate().Mandatory().RunAsync(throwOnError: true).ConfigureAwait(false); Cleaner.CleanUp(value); return(Cleaner.Clean(await _dataService.CreateAsync(value).ConfigureAwait(false))); }, BusinessInvokerArgs.Create).ConfigureAwait(false);
public Task <TripPerson> CreateAsync(TripPerson value) { value.Validate(nameof(value)).Mandatory().Run().ThrowOnError(); return(ManagerInvoker.Default.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Create; EntityBase.CleanUp(value); if (_createOnPreValidateAsync != null) { await _createOnPreValidateAsync(value).ConfigureAwait(false); } MultiValidator.Create() .Add(value.Validate(nameof(value))) .Additional((__mv) => _createOnValidate?.Invoke(__mv, value)) .Run().ThrowOnError(); if (_createOnBeforeAsync != null) { await _createOnBeforeAsync(value).ConfigureAwait(false); } var __result = await TripPersonDataSvc.CreateAsync(value).ConfigureAwait(false); if (_createOnAfterAsync != null) { await _createOnAfterAsync(__result).ConfigureAwait(false); } Cleaner.Clean(__result); return __result; })); }
public Task <TripPerson> UpdateAsync(TripPerson value) { return(DataInvoker.Current.InvokeAsync(this, async() => { var __dataArgs = ODataMapper.Default.CreateArgs(); return await _odata.UpdateAsync(__dataArgs, Check.NotNull(value, nameof(value))).ConfigureAwait(false); })); }
public Task <WebApiAgentResult <TripPerson> > UpdateAsync(TripPerson value, string?id, WebApiRequestOptions?requestOptions = null) { if (value == null) { throw new ArgumentNullException("value"); } return(TripPersonServiceAgent.UpdateAsync(value, id, requestOptions)); }
public Task <WebApiAgentResult <TripPerson> > CreateAsync(TripPerson value, WebApiRequestOptions?requestOptions = null) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(PostAsync <TripPerson>("api/v1/tripPeople", value, requestOptions: requestOptions, args: Array.Empty <WebApiArg>())); }
public Task <WebApiAgentResult <TripPerson> > UpdateAsync(TripPerson value, string?id, WebApiRequestOptions?requestOptions = null) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(PutAsync <TripPerson>("api/v1/tripPeople/{id}", value, requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <string?>("id", id) })); }
public void D110_Update_NotFound() { var p = new TripPerson { Id = "willieashmore", FirstName = "WillieXXX", LastName = "AshmoreYYY" }; AgentTester.Create <TripPersonAgent, TripPerson>() .ExpectStatusCode(HttpStatusCode.NotFound) .Run((a) => a.Agent.UpdateAsync(p, "xyz")); }
public void C110_Create() { var p = new TripPerson { Id = "masm", FirstName = "Mary", LastName = "Smith" }; AgentTester.Create <TripPersonAgent, TripPerson>() .ExpectStatusCode(HttpStatusCode.Created) .Run((a) => a.Agent.CreateAsync(p)); }
public Task <WebApiAgentResult <TripPerson> > CreateAsync(TripPerson value, WebApiRequestOptions?requestOptions = null) { if (value == null) { throw new ArgumentNullException("value"); } return(base.PostAsync <TripPerson>("api/v1/tripPeople", value, requestOptions: requestOptions, args: new WebApiArg[] { })); }
public void D120_Update() { var p = new TripPerson { Id = "willieashmore", FirstName = "Willie", LastName = "AshmoreYYY" }; AgentTester.Create <TripPersonAgent, TripPerson>() .ExpectStatusCode(HttpStatusCode.OK) .ExpectValue(_ => p) .Run((a) => a.Agent.UpdateAsync(p, p.Id)); }
public Task <TripPerson> CreateAsync(TripPerson value) { value.Validate(nameof(value)).Mandatory().Run().ThrowOnError(); return(ManagerInvoker.Current.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Create; Cleaner.CleanUp(value); return Cleaner.Clean(await _dataService.CreateAsync(value).ConfigureAwait(false)); })); }
public static Trip ConvertTripFromDataSet(DataSet ds) { Trip trip = null; DataTable dtTrip = ds.Tables[0]; DataTable dtPersonInfo = ds.Tables[1]; if (dtTrip.Rows.Count > 0 && dtPersonInfo.Rows.Count > 0) { trip = new Trip(); DataRow tripRow = dtTrip.Rows[0]; trip.TripID = tripRow["TripID"].ToString(); trip.StartTime = tripRow["TripStartTime"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(tripRow["TripStartTime"]); trip.EndTime = tripRow["TripEndTime"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(tripRow["TripEndTime"]); trip.ActualStartTime = tripRow["ActualTripStartTime"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(tripRow["ActualTripStartTime"]); trip.ActualEndTime = tripRow["ActualTripEndTime"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(tripRow["ActualTripEndTime"]); trip.TotalTime = tripRow["TotalTime"].ToString(); trip.TotalDistance = tripRow["Distance"].ToString(); trip.Status = tripRow["CurrentStatus"].ToString(); trip.ISPickUpTrip = Convert.ToBoolean(tripRow["IsPickUpTrip"]); trip.OfficeAddr = new EZMoveCoordinates(); trip.OfficeAddr.Latitude = Convert.ToDouble(tripRow["OfficeLat"]); trip.OfficeAddr.Longitude = Convert.ToDouble(tripRow["OfficeLong"]); trip.CurrentLocation = new EZMoveAddressExt(); trip.CurrentLocation.Latitude = Convert.ToDouble(tripRow["CurrentLat"]); trip.CurrentLocation.Longitude = Convert.ToDouble(tripRow["CurrentLong"]); trip.VechileData = new TripVechile(); trip.VechileData.VechileNumber = tripRow["VechileNo"].ToString(); trip.VechileData.VechileModel = tripRow["VechileName"].ToString(); trip.DriverData = new TripDriver(); trip.DriverData.DriverName = tripRow["FirstName"].ToString() + " " + tripRow["LastName"].ToString(); trip.DriverData.DriverPhoneNumber = tripRow["Phone"].ToString(); trip.PassengarInfo = new Dictionary <int, TripPerson>(); foreach (DataRow dr in dtPersonInfo.Rows) { TripPerson pInfo = new TripPerson(); pInfo.BoardedTime = dr["PickDropTime"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(dr["PickDropTime"]); pInfo.ActualBoardedTime = dr["ActualPickDropTime"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(dr["ActualPickDropTime"]); pInfo.Order = Convert.ToInt32(dr["PersonOrder"]); pInfo.ID = Convert.ToInt32(dr["PersonID"]); pInfo.Status = dr["CurrentStatus"].ToString(); pInfo.Name = dr["FirstName"].ToString() + " " + dr["LastName"].ToString(); pInfo.Phone = dr["Phone"].ToString(); pInfo.Email = dr["email"].ToString(); pInfo.PersonLocation = new EZMoveCoordinates(); pInfo.PersonLocation.Latitude = Convert.ToDouble(dr["Latitude"]); pInfo.PersonLocation.Longitude = Convert.ToDouble(dr["Longitude"]); trip.PassengarInfo.Add(pInfo.ID, pInfo); } } return(trip); }
public Task <TripPerson> UpdateAsync(TripPerson value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(DataInvoker.Current.InvokeAsync(this, async() => { var __dataArgs = ODataMapper.Default.CreateArgs(); return await _odata.UpdateAsync(__dataArgs, value).ConfigureAwait(false); })); }
public IActionResult Create([FromBody] TripPerson value) => new WebApiPost <TripPerson>(this, () => _manager.CreateAsync(WebApiActionBase.Value(value)), operationType: OperationType.Create, statusCode: HttpStatusCode.Created, alternateStatusCode: null);
public Task <WebApiAgentResult <TripPerson> > CreateAsync(TripPerson value, WebApiRequestOptions?requestOptions = null) => PostAsync <TripPerson>("api/v1/tripPeople", Beef.Check.NotNull(value, nameof(value)), requestOptions: requestOptions, args: Array.Empty <WebApiArg>());
public Task <WebApiAgentResult <TripPerson> > UpdateAsync(TripPerson value, string?id, WebApiRequestOptions?requestOptions = null) => PutAsync <TripPerson>("api/v1/tripPeople/{id}", Beef.Check.NotNull(value, nameof(value)), requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <string?>("id", id) });
public Task <WebApiAgentResult <TripPerson> > UpdateAsync(TripPerson value, string?id, WebApiRequestOptions?requestOptions = null) => TripPersonServiceAgent.UpdateAsync(Check.NotNull(value, nameof(value)), id, requestOptions);
public IActionResult Update([FromBody] TripPerson value, string?id) { return(new WebApiPut <TripPerson>(this, () => Factory.Create <ITripPersonManager>().UpdateAsync(WebApiActionBase.Value(value), id), operationType: OperationType.Update, statusCode: HttpStatusCode.OK, alternateStatusCode: null)); }
public Task <TripPerson> UpdateAsync(TripPerson value) => DataInvoker.Current.InvokeAsync(this, async() => { var __dataArgs = ODataArgs.Create(_mapper); return(await _odata.UpdateAsync <TripPerson, Model.Person>(__dataArgs, Check.NotNull(value, nameof(value))).ConfigureAwait(false)); });
public IActionResult Update([FromBody] TripPerson value, string?id) => new WebApiPut <TripPerson>(this, () => _manager.UpdateAsync(WebApiActionBase.Value(value), id), operationType: OperationType.Update, statusCode: HttpStatusCode.OK, alternateStatusCode: null);