public JsonResult Post([FromBody] GlxUserRequest req)
        {
            var i18 = JsonConvert.DeserializeObject <i_18_Object>(req.jsonStr);

            var jsonFile = System.IO.File.ReadAllText(srvPath + i18.fileName);

            JObject jsonObj = JsonConvert.DeserializeObject <JObject>(jsonFile);

            JObject page = jsonObj[i18.page] as JObject;

            if (page == null)
            {
                jsonObj.Add(i18.page, JObject.Parse(@"{""" + i18.key + @""":""" + i18.line + @"""}"));
            }

            if (page != null)
            {
                var key = page[i18.key];

                if (key == null)
                {
                    page.Add(i18.key, i18.line);
                }

                if (key != null)
                {
                    jsonObj[i18.page][i18.key] = i18.line;
                }
            }

            System.IO.File.WriteAllText(srvPath + i18.fileName, jsonObj.ToString());

            return(Json("asdf"));
        }
Beispiel #2
0
        public JsonResult Post([FromBody] GlxUserRequest req)
        {
            var loingUid = _xUserRepo.Login(req.glxUser.email, req.glxUser.password);
            var ip       = req.glxUser.ip;

            if (loingUid == null)
            {
                if (!_xOrderRepo.CheckNoUser(ip))
                {
                    _xOrderRepo.CreateOrderNoUser(ip);
                    return(Json(_xOrderRepo.GetCurrentOrderNoUser(ip)));
                }
            }
            else
            {
                var userUid = _xUserRepo.GetSignle(loingUid).uid;

                if (!_xOrderRepo.Check(req.glxUser.email))
                {
                    if (_xOrderRepo.Check_ip(ip))
                    {
                        _xOrderRepo.updateOrder_ip(userUid, ip);
                    }
                    else
                    {
                        _xOrderRepo.CreateOrder(userUid, ip);
                    }

                    return(Json(_xOrderRepo.GetCurrentOrder(req.glxUser.email)));
                }
            }

            return(Json(new xOrder().InitDummy()));
        }
        public JsonResult Post([FromBody] GlxUserRequest req)
        {
            if (!_xUserRepo.CheckLogin(req.glxUser.email))
            {
                req.glxUser.ip = req.glxUser.ip;
                var loginUid = _xUserRepo.CreateLogin(req.glxUser);
                _xUserRepo.Create(loginUid);

                return(Json(new xUser(req.glxUser)));
            }

            return(Json(new ReqRes()
            {
                error = true, msg = "user already exsists"
            }));
        }
Beispiel #4
0
        public JsonResult Post([FromBody] GlxUserRequest req)
        {
            //var adr = string.IsNullOrEmpty(req.ship_address_attributes.uid) ? _service.Create(req.ship_address_attributes, string.IsNullOrEmpty(req.glxUser.email) ? req.Order.email : req.glxUser.email) : _service.Update(req.ship_address_attributes);

            var res = new xAddress();

            if (_service.CanCreateNewAddress(req.ship_address_attributes.uid))
            {
                var email = _service.GetEmailFromRequest(req);
                res = _service.Create(req.ship_address_attributes, email);
            }
            else
            {
                res = _service.Update(req.ship_address_attributes);
            }

            req.Order.ship_address = res;
            req.Order.bill_address = res;

            return(Json(req.Order));
        }
Beispiel #5
0
        public JsonResult UpdateOrder([FromBody] GlxUserRequest req)
        {
            var res = _xOrderService.HandleUpdateOrder(req);

            return(Json(req.Order));
        }
Beispiel #6
0
        public JsonResult Delete([FromBody] GlxUserRequest req)
        {
            var res = _service.Delete(req.ship_address_attributes.uid);

            return(Json(req.Order));
        }
Beispiel #7
0
 public void Post([FromBody] GlxUserRequest req)
 {
 }
 public JsonResult UpdateUser([FromBody] GlxUserRequest req)
 {
     return(Json(_xUserRepo.Update(req.xUser)));
 }