public async Task <IActionResult> GetLocationAddressView(long locationAddressId) { LocationAddressModule invMod = new LocationAddressModule(); LocationAddressView view = await invMod.LocationAddress.Query().GetViewById(locationAddressId); return(Ok(view)); }
public async Task <IActionResult> DeleteLocationAddress([FromBody] LocationAddressView view) { LocationAddressModule invMod = new LocationAddressModule(); LocationAddress locationAddress = await invMod.LocationAddress.Query().MapToEntity(view); invMod.LocationAddress.DeleteLocationAddress(locationAddress).Apply(); return(Ok(view)); }
public async Task <IActionResult> UpdateLocationAddress([FromBody] LocationAddressView view) { LocationAddressModule invMod = new LocationAddressModule(); LocationAddress locationAddress = await invMod.LocationAddress.Query().MapToEntity(view); invMod.LocationAddress.UpdateLocationAddress(locationAddress).Apply(); LocationAddressView retView = await invMod.LocationAddress.Query().GetViewById(locationAddress.LocationAddressId); return(Ok(retView)); }
public async Task <IActionResult> AddLocationAddress([FromBody] LocationAddressView view) { LocationAddressModule invMod = new LocationAddressModule(); NextNumber nnLocationAddress = await invMod.LocationAddress.Query().GetNextNumber(); view.LocationAddressNumber = nnLocationAddress.NextNumberValue; LocationAddress locationAddress = await invMod.LocationAddress.Query().MapToEntity(view); invMod.LocationAddress.AddLocationAddress(locationAddress).Apply(); LocationAddressView newView = await invMod.LocationAddress.Query().GetViewByNumber(view.LocationAddressNumber); return(Ok(newView)); }
public async Task TestAddUpdatDelete() { LocationAddressModule LocationAddressMod = new LocationAddressModule(); AddressBook addressBook = await LocationAddressMod.AddressBook.Query().GetEntityById(1); Udc udc = await LocationAddressMod.Udc.Query().GetEntityById(60); LocationAddressView view = new LocationAddressView() { AddressLine1 = "123 abc", City = "Boise", Zipcode = "83709", TypeXrefId = udc.XrefId, Type = udc.Value, AddressId = addressBook.AddressId, Name = addressBook.Name, State = "ID", Country = "USA" }; NextNumber nnNextNumber = await LocationAddressMod.LocationAddress.Query().GetNextNumber(); view.LocationAddressNumber = nnNextNumber.NextNumberValue; LocationAddress locationAddress = await LocationAddressMod.LocationAddress.Query().MapToEntity(view); LocationAddressMod.LocationAddress.AddLocationAddress(locationAddress).Apply(); LocationAddress newLocationAddress = await LocationAddressMod.LocationAddress.Query().GetEntityByNumber(view.LocationAddressNumber); Assert.NotNull(newLocationAddress); newLocationAddress.Type = "Residence Update"; LocationAddressMod.LocationAddress.UpdateLocationAddress(newLocationAddress).Apply(); LocationAddressView updateView = await LocationAddressMod.LocationAddress.Query().GetViewById(newLocationAddress.LocationAddressId); Assert.Same(updateView.Type, "Residence Update"); LocationAddressMod.LocationAddress.DeleteLocationAddress(newLocationAddress).Apply(); LocationAddress lookupLocationAddress = await LocationAddressMod.LocationAddress.Query().GetEntityById(view.LocationAddressId); Assert.Null(lookupLocationAddress); }