コード例 #1
0
 public Member_addressbookInfo Save()
 {
     if (this.Id != null)
     {
         Member_addressbook.Update(this);
         return(this);
     }
     this.Create_time = DateTime.Now;
     return(Member_addressbook.Insert(this));
 }
コード例 #2
0
        public ActionResult Edit([FromQuery] uint Id)
        {
            Member_addressbookInfo item = Member_addressbook.GetItem(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
コード例 #3
0
        public APIReturn _Del([FromForm] uint[] ids)
        {
            int affrows = 0;

            foreach (uint id in ids)
            {
                affrows += Member_addressbook.Delete(id);
            }
            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"删除成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
コード例 #4
0
        public APIReturn _Add([FromForm] uint?Member_id, [FromForm] string Address, [FromForm] bool?Is_default, [FromForm] string Name, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] string Zip)
        {
            Member_addressbookInfo item = new Member_addressbookInfo();

            item.Member_id   = Member_id;
            item.Address     = Address;
            item.Create_time = DateTime.Now;
            item.Is_default  = Is_default;
            item.Name        = Name;
            item.Tel         = Tel;
            item.Telphone    = Telphone;
            item.Zip         = Zip;
            item             = Member_addressbook.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
コード例 #5
0
        public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Member_id, [FromForm] string Address, [FromForm] bool?Is_default, [FromForm] string Name, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] string Zip)
        {
            Member_addressbookInfo item = Member_addressbook.GetItem(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            item.Member_id   = Member_id;
            item.Address     = Address;
            item.Create_time = DateTime.Now;
            item.Is_default  = Is_default;
            item.Name        = Name;
            item.Tel         = Tel;
            item.Telphone    = Telphone;
            item.Zip         = Zip;
            int affrows = Member_addressbook.Update(item);

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
コード例 #6
0
 public Member_addressbookInfo AddAddressbook(string Address, DateTime?Create_time, bool?Is_default, string Name, string Tel, string Telphone, string Zip) => Member_addressbook.Insert(new Member_addressbookInfo {
     Member_id   = this.Id,
     Address     = Address,
     Create_time = Create_time,
     Is_default  = Is_default,
     Name        = Name,
     Tel         = Tel,
     Telphone    = Telphone,
     Zip         = Zip
 });