public ActionResult GetTaxRegimeTypes() { var result = _taxRegimeTypeOperation.GetAll() .Select(tr => TaxRegimeTypeViewModel.FromDto(tr)); if (result.Any()) { return(Ok(result)); } return(NotFound()); }
public ActionResult UpdateTaxRegimeType(long id, TaxRegimeTypeViewModel viewModel) => _taxRegimeTypeOperation .Update(id, viewModel.ToDto()) .Match <ActionResult>( Left: err => BadRequest(err.Message), Right: tr => Ok(TaxRegimeTypeViewModel.FromDto(tr)));
public IActionResult GetTaxRegimeType(long id) => _taxRegimeTypeOperation .Find(id) .Match <ActionResult>( Left: err => NotFound(err.Message), Right: t => Ok(TaxRegimeTypeViewModel.FromDto(t)));
public ActionResult CreateTaxRegimeType(TaxRegimeTypeViewModel viewModel) => _taxRegimeTypeOperation .Create(viewModel.ToDto()) .Match <ActionResult>( Left: err => BadRequest(err.Message), Right: t => Ok(TaxRegimeTypeViewModel.FromDto(t)));