Example #1
0
        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":"删除失败"));
        }
Example #2
0
        /// <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));
        }
Example #3
0
        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":"保存失败"));
        }