public IActionResult RegisterAsigCashAccBranch([FromBody] AsignmentCashAccBranch asignmentCashAccBranch) { try { AsignmentCashAccBranch result = GLHelper.RegisterCashAccToBranches(asignmentCashAccBranch); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "" })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult UpdateaAignmentCashAccBranch([FromBody] AsignmentCashAccBranch asignmentCashAccBranch) { if (asignmentCashAccBranch == null) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"{nameof(asignmentCashAccBranch)} cannot be null" })); } try { AsignmentCashAccBranch result = GLHelper.UpdateCashAccToBranches(asignmentCashAccBranch); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = "Updation Failed" })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public IActionResult DeleteAignmentCashAccBranch(string code) { if (string.IsNullOrWhiteSpace(code)) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"{nameof(code)} cannot be null" })); } try { AsignmentCashAccBranch result = GLHelper.DeleteCashAccToBranches(code); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } 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 })); } }
public static AsignmentCashAccBranch UpdateCashAccToBranches(AsignmentCashAccBranch assignCashToBranch) { try { using Repository <AsignmentCashAccBranch> repo = new Repository <AsignmentCashAccBranch>(); repo.AsignmentCashAccBranch.Update(assignCashToBranch); if (repo.SaveChanges() > 0) { return(assignCashToBranch); } return(null); } catch { throw; } }
public static AsignmentCashAccBranch RegisterCashAccToBranches(AsignmentCashAccBranch assignCashToBranch) { try { using Repository <AsignmentCashAccBranch> repo = new Repository <AsignmentCashAccBranch>(); assignCashToBranch.Active = "Y"; assignCashToBranch.AddDate = DateTime.Now; repo.AsignmentCashAccBranch.Add(assignCashToBranch); if (repo.SaveChanges() > 0) { return(assignCashToBranch); } return(null); } catch { throw; } }