public async Task <IActionResult> GetTaxStructureList() { var result = await Task.Run(() => { try { dynamic expando = new ExpandoObject(); var TaxStructureList = new TaxstructureHelpers().GetList(); expando.TaxStructureList = TaxStructureList; return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = expando })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }); return(result); }
public IActionResult RegisterTaxStructure([FromBody] TblTaxStructure taxstructure) { if (taxstructure == null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = "object can not be null" })); } try { //var taxstructurelist = new TaxgroupHelpers().GetList(taxstructure.TaxGroupCode); //if (taxstructurelist.Count() > 0) // return Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = $"productpacking Code {nameof(taxstructurelist)} is already exists ,Please Use Different Code " }); var result = new TaxstructureHelpers().Register(taxstructure); APIResponse apiResponse; if (result != null) { apiResponse = new APIResponse() { status = APIStatus.PASS.ToString(), response = result }; } else { apiResponse = new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Registration Failed." }; } return(Ok(apiResponse)); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult DeleteTaxStructure(string code) { try { if (code == null) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "code can not be null" })); } var rs = new TaxstructureHelpers().Delete(code); APIResponse apiResponse; if (rs != null) { apiResponse = new APIResponse() { status = APIStatus.PASS.ToString(), response = rs }; } else { apiResponse = new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Deletion Failed." }; } return(Ok(apiResponse)); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult UpdateTaxStructure([FromBody] TblTaxStructure taxstructure) { if (taxstructure == null) { return(Ok(new APIResponse { status = APIStatus.FAIL.ToString(), response = $"{nameof(taxstructure)} cannot be null" })); } try { var rs = new TaxstructureHelpers().Update(taxstructure); APIResponse apiResponse; if (rs != null) { apiResponse = new APIResponse() { status = APIStatus.PASS.ToString(), response = rs }; } else { apiResponse = new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Updation Failed." }; } return(Ok(apiResponse)); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }