public Response Update(Request <BranchUpdate> request) { try { ValidateBaseRequest(request); var branchService = BranchService.GetInstance(); return(branchService.Update(request)); } catch (RestaurantException ex) { return(new Response { ErrorCode = ex.ErrorCode }); } catch (Exception e) { return(new Response { ErrorCode = new ErrorCode { ErrorMessage = e.Message, ErrorNumber = ErrorNumber.GeneralError } }); } }
public ActionMessage createBranch([FromBody] BranchInfo branch) { ActionMessage ret = new ActionMessage(); try { ret = BranchService.GetInstance().createBranch(branch); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage deleteManyBranch(string ids) { ActionMessage ret = new ActionMessage(); try { ret = BranchService.GetInstance().deleteManyBranch(ids); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public SingleResponeMessage <BranchInfo> editBranch([FromBody] BranchInfo branch) { SingleResponeMessage <BranchInfo> ret = new SingleResponeMessage <BranchInfo>(); try { ret.isSuccess = true; BranchService.GetInstance().editBranch(branch); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public SingleResponeMessage <BranchInfo> getBranchById(int id) { SingleResponeMessage <BranchInfo> ret = new SingleResponeMessage <BranchInfo>(); try { ret.isSuccess = true; ret.item = BranchService.GetInstance().getBranchById(id); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ListResponeMessage <BranchInfo> GetList(int page = 1, int size = 10) { ListResponeMessage <BranchInfo> ret = new ListResponeMessage <BranchInfo>(); try { ret.isSuccess = true; ret.data = BranchService.GetInstance().getAllBranch(page, size); ret.totalRecords = BranchService.GetInstance().GetTotalRecordBranch(); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "005"; ret.err.msgString = ex.ToString(); } return(ret); }
public ListResponeMessage <BranchInfo> Search(string query, int page = 1, int size = 10) { ListResponeMessage <BranchInfo> ret = new ListResponeMessage <BranchInfo>(); try { ret.isSuccess = true; ret.data = BranchService.GetInstance().search(query, page, size); ret.totalRecords = BranchService.GetInstance().totalRecordSearch(query); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "005"; ret.err.msgString = ex.ToString(); } return(ret); }
public static List <Branch> GetBranches(Request <BaseList> request) { try { if (Branches == null) { var branchService = BranchService.GetInstance(); var response = branchService.List(new Request()); Branches = response.Data; } return(Branches.Where(m => CheckBasicFilter(m, request)).ToList()); } catch (RestaurantException ex) { throw ex; } catch (Exception e) { throw e; } }