コード例 #1
0
 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
             }
         });
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 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;
     }
 }