public IActionResult UpdateMaterialGroup([FromBody] MaterialGroup materialGroups) { if (materialGroups == null) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"{nameof(materialGroups)} cannot be null" })); } try { MaterialGroup result = MaterialGroupHelper.UpdateMaterialGroup(materialGroups); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"{nameof(materialGroups)} Updation Failed" })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult GetAllMaterialGroup() { try { var materialGroupList = MaterialGroupHelper.GetMaterialGroupList(); if (materialGroupList.Count > 0) { dynamic expando = new ExpandoObject(); expando.materialGroupList = MaterialGroupHelper.GetMaterialGroupList(); return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = expando })); } else { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "No Data Found." })); } } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult GetMaterialGroupList() { try { dynamic expando = new ExpandoObject(); expando.MaterialGroupList = MaterialGroupHelper.GetMaterialGroupList().Select(matgrp => new { ID = matgrp.Code, TEXT = matgrp.GroupName }); return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = expando })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult GetAccountingClassList() { try { var accountingClassList = MaterialGroupHelper.GetAccountingClassList(); dynamic expando = new ExpandoObject(); expando.accountingClassList = accountingClassList.Select(x => new { ID = x, TEXT = x }); return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = expando })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult DeleteMaterialGroup(string code) { if (string.IsNullOrWhiteSpace(code)) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"{nameof(code)} cannot be null" })); } try { MaterialGroup result = MaterialGroupHelper.DeleteMaterialGroup(code); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = code })); } else { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Deletion Failed" })); } } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }