Example #1
0
        public JsonResult <ApiMobileObject> GetInfoCustomerByPhone(string Phone)
        {
            ApiMobileObject result = new ApiMobileObject();

            using (THUONGMAIDIENTUEntities db = new THUONGMAIDIENTUEntities())
            {
                var url          = "http://localhost:58702/";
                var InfoCustomer = db.CUSTOMERs.Where(x => x.CustomerPhone == Phone.ToString()).FirstOrDefault();
                if (InfoCustomer is null)
                {
                    result.Success = false;
                    result.Message = "Lấy InfoCostomer thất bại. SĐT không tồn tại trong hệ thống";
                    result.Data    = null;
                }
                else
                {
                    ModalInfoCustomer InfoCTM = new ModalInfoCustomer();
                    InfoCTM.IdCustomer      = InfoCustomer.IdCustomer;
                    InfoCTM.CustomerName    = InfoCustomer.CustomerName;
                    InfoCTM.CustomerAddress = InfoCustomer.CustomerAddress;
                    InfoCTM.CustomerPhone   = InfoCustomer.CustomerPhone;
                    InfoCTM.CustomerEmail   = InfoCustomer.CustomerEmail;
                    result.Success          = true;
                    result.Message          = "Lấy list Product By IDCategory thành công";

                    result.Data = InfoCTM;
                }
            }

            return(Json(result));
        }
Example #2
0
        public JsonResult <ApiMobileObject> CheckCodeDiscount(string code)
        {
            ApiMobileObject result = new ApiMobileObject();

            using (THUONGMAIDIENTUEntities db = new THUONGMAIDIENTUEntities())
            {
                var giftCode = db.GIFTCODEs.Where(x => x.Code == code.ToString()).FirstOrDefault();
                if (giftCode is null || giftCode.Status == true)
                {
                    result.Success = false;
                    result.Message = "Giftcode đã được sử dụng hoặc không tồn tại!";
                    result.Data    = null;
                    return(Json(result));
                }