Ejemplo n.º 1
0
        public ActionResult AddShop(int id = 0)
        {
            var model = new UpdateShopModel();
            ViewBag.Title = "新增公司";
            if (id > 0)
            {
                var shop = Shop.Get(id);

                if (shop != null)
                {
                    var user = YunClient.Instance.Execute(new GetUserRequest {Nick = shop.ShopKeeper}).User;
                    ViewData["uname"] = user.Nick;
                    ViewData["Money"] = user.Money;

                    model = new UpdateShopModel
                    {
                        Address = shop.Address,
                        Bulletin = shop.Bulletin,
                        Description = shop.Description,
                        Hours = shop.Hours,
                        Phone = shop.Phone,
                        Summary = shop.Summary,
                        Title = shop.Title,
                        Location = shop.Location,
                        //Longlat = cate.Longlat,
                        Image = shop.Picture,
                        Category=shop.CategoryId,
                    };
                }
                ViewBag.Title = "编辑公司信息";
            }

            return View(model);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 店铺设置
        /// </summary>
        /// <returns></returns>
        public ActionResult UpdateShop()
        {
            var shop = Partner.GetShop();
            var model = new UpdateShopModel
            {
                Address = shop.Address,
                Bulletin = shop.Bulletin,
                Description = shop.Description,
                Hours = shop.Hours,
                Phone = shop.Phone,
                Summary = shop.Summary,
                Title = shop.Title,
                Location = shop.Location,
                Longlat = shop.Coordinate,
                Image = shop.Picture
            };

            return View(model);
        }
Ejemplo n.º 3
0
        public ActionResult UpdateShop(UpdateShopModel model)
        {
            if (ModelState.IsValid)
            {
                var r = Partner.UpdateShop(model.Title, model.Phone, model.Hours, model.Address,
                    model.Summary,
                    model.Bulletin, model.Description, model.Location, model.Longlat, model.Image);

                if (r)
                {
                    TempData["success"] = "店铺基础信息更新成功";
                }
                else
                {
                    TempData["error"] = "店铺基础信息更新失败";
                }
            }
            return View(model);
        }
Ejemplo n.º 4
0
        public ActionResult AddShop(UpdateShopModel model, int id = 0)
        {
            if (ModelState.IsValid)
            {
                bool r;
                if (id <= 0)
                {
                    r = YunClient.Instance.Execute(new AddShopRequest
                    {
                        UserName=model.UserName,
                        Password=model.UserPassword,
                        Address = model.Address,
                        Coordinate = model.Longlat,
                        Hours = model.Hours,
                        Location = model.Location,
                        Name = model.Title,
                        Phone = model.Phone,
                        Summary = model.Summary,
                        Description = model.Description,
                        Bulletin = model.Bulletin,
                        Image = Commodity.GetFirstFile(),
                        AppSecret = YunClient.AppSecret
                    }, Member.Token).Result > 0;
                }
                else
                {
                    r = YunClient.Instance.Execute(new UpdateShopRequest
                    {

                        Address = model.Address,
                        Coordinate = model.Longlat,
                        Hours = model.Hours,
                        Location = model.Location,
                        Title = model.Title,
                        Phone = model.Phone,
                        Summary = model.Summary,
                        Description = model.Description,
                        Bulletin = model.Bulletin,
                        ShopId = id,
                        Image = model.Image,
                        NewImage = Commodity.GetFirstFile(),
                        Password=model.UserPassword,
                        AppSecret = YunClient.AppSecret,
                    }, Member.Token).Result;

                    if (r)
                    {
                        CacheManage.ShopCache.Remove(id);
                    }
                }

                if (r)
                {
                    TempData["success"] = "店铺信息提交成功";
                }
                else
                {
                    TempData["error"] = "店铺信息提交失败,请返回后重新尝试";
                }

                return RedirectToAction("ShopManagment", "Partner");
            }

            return View(model);
        }