public IActionResult GetItemMasterList() { try { var itemMasterList = ItemMasterHelper.GetItemMasterList(); if (itemMasterList.Count > 0) { dynamic expando = new ExpandoObject(); expando.itemMasterList = itemMasterList; return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = expando })); } return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = "No Data Found." })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult RegisterItemMaster([FromBody] ItemMaster itemMaster) { try { if (ItemMasterHelper.GetItemMasterList(itemMaster.ItemNumber).Count > 0) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"Code ={itemMaster.ItemNumber} Already exists." })); } ItemMaster result = ItemMasterHelper.RegisterItemMaster(itemMaster); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = " Registration Failed" })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }