public async Task CreateNewPropertyTraceTestDefault() { RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow); var property = new PropertyTraceModelView { DateSale = DateTime.Now, IdProperty = -1, Name = "Test Name", Tax = 20, Value = 20000 }; var result = await realEstate.CreatePropertyTraceAsync(property); Assert.IsTrue(result > 0); }
public async Task <IActionResult> CreatePropertyTraceBuilding([FromForm] PropertyTraceModelView propertyTrace) { if (!TryValidateModel(propertyTrace)) { return(BadRequest(GetFullErrorMessage(ModelState))); } var idPropertyTrace = await _realEstateServices.CreatePropertyTraceAsync(propertyTrace); return(Ok(idPropertyTrace)); }
public async Task <int> CreatePropertyTraceAsync(PropertyTraceModelView propertyTraceModelView, CancellationToken token = default) { var property = await _uow.GetObjectByKeyAsync <Property>(propertyTraceModelView.IdProperty).ConfigureAwait(false); if (property == null) { property = await CreateDefaultPropertyBuildingAsync(); } var propertyTrace = new PropertyTrace(_uow); propertyTrace.Property = property; propertyTrace.Name = propertyTraceModelView.Name; propertyTrace.Tax = propertyTraceModelView.Tax; propertyTrace.Value = propertyTraceModelView.Value; propertyTrace.DateSale = propertyTraceModelView.DateSale; await _uow.CommitTransactionAsync(); return(await Task.FromResult(propertyTrace.Oid)); }
public Task <int> CreatePropertyTraceAsync(PropertyTraceModelView propertyTraceModelView, CancellationToken token = default) { throw new NotImplementedException(); }