예제 #1
0
        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
                }));
            }
        }
예제 #2
0
 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
         }));
     }
 }
예제 #3
0
 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
         }));
     }
 }
예제 #4
0
 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
         }));
     }
 }
예제 #5
0
        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
                }));
            }
        }