コード例 #1
0
        public IActionResult Post(Store store)
        {
            var res = new DataRespone();

            // lấy dữ liệu từ database
            store.StoreId = new Guid();
            var entitie = _storeService.Insert(store);

            // Kiểm tra dữ liệu trả về
            if (entitie == 0)
            {
                res.OnBadRequest(res);
                res.DevMsg  = "Có lỗi xảy ra !";
                res.UserMsg = "Thêm mới cửa hàng thất bại!";
                res.Data    = entitie;
                return(BadRequest(res));
            }
            else
            {
                res.OnSuccess(res);
                res.DevMsg  = "Thêm cửa hàng thành công!";
                res.UserMsg = "Thêm mới cửa hàng thành công!";
                res.Data    = entitie;
                return(Ok(res));
            }
        }
コード例 #2
0
        public IActionResult GetStoreByCode(string storeCode)
        {
            var res = new DataRespone();
            // lấy dữ liệu từ database
            var entitie = _storeService.GetByStoreCode(storeCode);

            res.OnSuccess(res);
            res.DevMsg  = "Lấy thông tin thành công!";
            res.UserMsg = "Lấy thông tin cửa hàng thành công!";
            res.Data    = entitie;
            return(Ok(res));
        }
コード例 #3
0
        public IActionResult GetCount()
        {
            var res = new DataRespone();
            // lấy dữ liệu từ database
            var entitie = _storeService.GetCountStore();

            // Kiểm tra dữ liệu trả về

            res.OnSuccess(res);
            res.DevMsg  = "Lấy thông tin thành công!";
            res.UserMsg = "Lấy thông tin cửa hàng thành công!";
            res.Data    = entitie;
            return(Ok(res));
        }
コード例 #4
0
        public IActionResult GetStoreFilter([FromQuery] PagingParameter parameter)
        {
            // string storeCode, string storeName, string address, string phoneNumber, int? status
            var res = new DataRespone();
            // lấy dữ liệu từ database
            var entitie = _storeService.GetStoreFilter(
                parameter.storeCode, parameter.storeName, parameter.address, parameter.phoneNumber, parameter.status);

            // Kiểm tra dữ liệu trả về

            res.OnSuccess(res);
            res.DevMsg  = "Lấy thông tin thành công!";
            res.UserMsg = "Lấy thông tin cửa hàng thành công!";
            res.Data    = entitie;
            return(Ok(res));
        }
コード例 #5
0
        public IActionResult Get(Guid entityId)
        {
            var res = new DataRespone();
            // lấy dữ liệu từ database
            var entitie = _baseService.GetById(entityId);

            // Kiểm tra dữ liệu trả về
            if (entitie == null)
            {
                res.OnBadRequest(res);
                res.DevMsg  = "Không có data !";
                res.UserMsg = "Không tìm thấy dữ liệu !";
                res.Data    = entitie;
                return(Ok(res));
            }
            else
            {
                res.OnSuccess(res);
                res.DevMsg  = "Lấy dữ liệu thành công!";
                res.UserMsg = "Lấy dữ liệu thành công!";
                res.Data    = entitie;
                return(Ok(res));
            }
        }
コード例 #6
0
        public IActionResult Put(Guid entityId, Store store)
        {
            var res = new DataRespone();
            // lấy dữ liệu từ database
            var entitie = _storeService.Update(store, entityId);

            // Kiểm tra dữ liệu trả về
            if (entitie == 0)
            {
                res.OnBadRequest(res);
                res.DevMsg  = "Có lỗi xảy ra !";
                res.UserMsg = "Thay đổi thông tin cửa hàng thất bại!";
                res.Data    = entitie;
                return(BadRequest(res));
            }
            else
            {
                res.OnSuccess(res);
                res.DevMsg  = "Thay đổi thông tin thành công!";
                res.UserMsg = "Thay đổi thông tin cửa hàng thành công!";
                res.Data    = entitie;
                return(Ok(res));
            }
        }
コード例 #7
0
        public IActionResult Delete(Guid entityId)
        {
            var res = new DataRespone();
            // lấy dữ liệu từ database
            var entitie = _storeService.Delete(entityId);

            // Kiểm tra dữ liệu trả về
            if (entitie == 0)
            {
                res.OnBadRequest(res);
                res.DevMsg  = "Có lỗi xảy ra !";
                res.UserMsg = "Có lỗi xảy ra !";
                res.Data    = entitie;
                return(BadRequest(res));
            }
            else
            {
                res.OnSuccess(res);
                res.DevMsg  = "Xóa cửa hàng thành công!";
                res.UserMsg = "Xóa cửa hàng thành công!";
                res.Data    = entitie;
                return(Ok(res));
            }
        }