public ContentResult ToIsNow(int id)
        {
            string rtn = C_UserMail.ToIsNowByID(id, CurrentUser.UserName);

            if (rtn == "ok")
            {
                return(Content("ok"));
            }
            return(Content("网络异常"));
        }
        public ContentResult toDel(int id)
        {
            C_UserMail mail = C_UserMail.GetEntityByID(id);

            if (mail == null || mail.UserName != CurrentUser.UserName)
            {
                return(Content("操作异常"));
            }
            int rtn = C_UserMail.DeleteByID(id);

            return(Content(rtn > 0?"ok":"删除失败"));
        }
Exemple #3
0
        //
        // GET: /C_UserCart/

        public ActionResult Index()
        {
            List <C_UserCartVM> carts = C_UserCartVM.getCarts(CurrentUser.C_UserTypeID, CurrentUser.UserName);

            ViewData["carts"] = carts;

            C_UserMail nowMail = C_UserMail.GetIsNow(CurrentUser.UserName);

            if (nowMail == null)
            {
                nowMail = new C_UserMail();
            }
            ViewData["nowMail"] = nowMail;
            return(View());
        }
        /// <summary>
        /// 地址添加
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit(int id = 0)
        {
            C_UserMail address = new C_UserMail();

            if (id != 0)
            {
                address = C_UserMail.GetEntityByID(id);
                if (address == null)
                {
                    return(View(ErrorPage.ViewName, new ErrorPage {
                        Message = "地址有误"
                    }));
                }
            }
            return(View(address));
        }
        public ActionResult toSave(C_UserMail address, FormCollection c)
        {
            address = new C_UserMail();
            int rtn = 0;
            int id  = 0;

            int.TryParse(c["ID"], out id);
            address.ID       = id;
            address.UserName = CurrentUser.UserName;
            address.Address  = c["Address"];
            address.Area     = c["Area"];
            int AreaID = 0;

            int.TryParse(c["AreaID"], out AreaID);
            address.AreaID = AreaID;
            address.City   = c["City"];
            int CityID = 0;

            int.TryParse(c["CityID"], out CityID);
            address.CityID        = CityID;
            address.ContactMobile = c["ContactMobile"];
            address.ContactName   = c["ContactName"];
            address.IsDefault     = false;
            address.Province      = c["Province"];
            int ProvinceID = 0;

            int.TryParse(c["ProvinceID"], out ProvinceID);
            address.ProvinceID = ProvinceID;
            if (address.ID == 0)
            {
                rtn = address.InsertAndReturnIdentity();
            }
            else
            {
                C_UserMail oldMail = C_UserMail.GetEntityByID(address.ID);
                if (oldMail == null || oldMail.UserName != CurrentUser.UserName)
                {
                    return(Content("操作异常"));
                }
                rtn = address.UpdateByID();
            }
            return(Content(rtn > 0?"ok":"保存失败"));
        }