public async Task <IActionResult> PutTaxablePersonType(int id, TaxablePersonType taxablePersonType) { if (id != taxablePersonType.Id) { return(BadRequest()); } _context.Entry(taxablePersonType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaxablePersonTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TaxablePersonType> > PostTaxablePersonType(TaxablePersonType taxablePersonType) { _context.TaxablePersonType.Add(taxablePersonType); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TaxablePersonTypeExists(taxablePersonType.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTaxablePersonType", new { id = taxablePersonType.Id }, taxablePersonType)); }
public async Task <ActionResult <IEnumerable <TaxablePersonType> > > GetTaxablePersonType([FromQuery] TaxablePersonType taxableperson) { IQueryable <TaxablePersonType> taxablepersontype = _context.TaxablePersonType; if (!string.IsNullOrEmpty(taxableperson.PersonTypeDescription)) { taxablepersontype = taxablepersontype.Where( i => i.PersonTypeDescription.ToLower().Contains(taxableperson.PersonTypeDescription.ToLower())); } return(await taxablepersontype.ToListAsync()); }