public RentsubletInfo Save() { if (this.Id != null) { Rentsublet.Update(this); return(this); } this.Create_time = DateTime.Now; return(Rentsublet.Insert(this)); }
public ActionResult Edit([FromQuery] uint Id) { RentsubletInfo item = Rentsublet.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } ViewBag.item = item; return(View()); }
public APIReturn _Del([FromForm] uint[] ids) { int affrows = 0; foreach (uint id in ids) { affrows += Rentsublet.Delete(id); } if (affrows > 0) { return(APIReturn.成功.SetMessage($"删除成功,影响行数:{affrows}")); } return(APIReturn.失败); }
public APIReturn _Add([FromForm] uint?Market_id, [FromForm] decimal?Price, [FromForm] RentsubletTYPE?Type, [FromForm] uint[] mn_Franchising) { RentsubletInfo item = new RentsubletInfo(); item.Market_id = Market_id; item.Create_time = DateTime.Now; item.Price = Price; item.Type = Type; item = Rentsublet.Insert(item); //关联 Franchising foreach (uint mn_Franchising_in in mn_Franchising) { item.FlagFranchising(mn_Franchising_in); } return(APIReturn.成功.SetData("item", item.ToBson())); }
public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Market_id, [FromForm] decimal?Price, [FromForm] RentsubletTYPE?Type, [FromForm] uint[] mn_Franchising) { RentsubletInfo item = Rentsublet.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } item.Market_id = Market_id; item.Create_time = DateTime.Now; item.Price = Price; item.Type = Type; int affrows = Rentsublet.Update(item); //关联 Franchising if (mn_Franchising.Length == 0) { item.UnflagFranchisingALL(); } else { List <uint> mn_Franchising_list = mn_Franchising.ToList(); foreach (var Obj_franchising in item.Obj_franchisings) { int idx = mn_Franchising_list.FindIndex(a => a == Obj_franchising.Id); if (idx == -1) { item.UnflagFranchising(Obj_franchising.Id); } else { mn_Franchising_list.RemoveAt(idx); } } mn_Franchising_list.ForEach(a => item.FlagFranchising(a)); } if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }
public RentsubletInfo AddRentsublet(DateTime?Create_time, decimal?Price, RentsubletTYPE?Type) => Rentsublet.Insert(new RentsubletInfo { Market_id = this.Id, Create_time = Create_time, Price = Price, Type = Type });