public static TaxRecord MapToTaxRecord(ZbaBotService.TaxRecord zbaTaxRecord) { var taxRecord = new TaxRecord { RevenueDown = zbaTaxRecord.RevenueDown, TaxInfo = new List<TaxInfo>() }; foreach (var taxInfo in zbaTaxRecord.TaxInfoYears.Select(zbaTaxYear => new TaxInfo { Interest = zbaTaxYear.Interest.ToString(CultureInfo.InvariantCulture), Lien = zbaTaxYear.Lien, Other = zbaTaxYear.Other.ToString(CultureInfo.InvariantCulture), Penalty = zbaTaxYear.Penalty.ToString(CultureInfo.InvariantCulture), Principal = zbaTaxYear.Principal.ToString(CultureInfo.InvariantCulture), Solicitor = zbaTaxYear.Solicitor, Status = zbaTaxYear.Status, Total = zbaTaxYear.Total.ToString(CultureInfo.InvariantCulture), Year = zbaTaxYear.Year })) { taxRecord.TaxInfo.Add(taxInfo); } return taxRecord; }
public TaxRecord Update(TaxRecord r) { using (var db = new TaxDB()) { r.Modified = _time.CurrentTime(); var res = db.Update(r); db.SaveChanges(); return(res.Entity); } }
public async Task <ActionResult <TaxRecord> > PostTaxRecord(TaxRecord taxRecord) { try { var createdRecord = await _cityTaxService.CreateTaxRecord(taxRecord); return(CreatedAtAction("GetTaxRecord", new { id = createdRecord.Id }, createdRecord)); } catch (InvalidOperationException exception) { return(BadRequest(exception.Message)); } }
public async Task <IActionResult> PutTaxRecord(int id, TaxRecord taxRecord) { if (id != taxRecord.Id) { return(BadRequest()); } try { await _cityTaxService.UpdateTaxRecord(taxRecord); } catch (InvalidOperationException exception) { return(BadRequest(exception.Message)); } return(NoContent()); }