public APIReturn _Add([FromForm] uint?Order_id, [FromForm] uint?Productitem_id, [FromForm] string Descript, [FromForm] string Email, [FromForm] string Img_url, [FromForm] IFormFile Img_url_file, [FromForm] Order_refundSTATE?State, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] decimal?Wealth) { Order_refundInfo item = new Order_refundInfo(); if (Img_url_file != null) { item.Img_url = $"/upload/{Guid.NewGuid().ToString()}.png"; using (FileStream fs = new FileStream(System.IO.Path.Combine(AppContext.BaseDirectory, item.Img_url), FileMode.Create)) Img_url_file.CopyTo(fs); } else { item.Img_url = Img_url; } item.Order_id = Order_id; item.Productitem_id = Productitem_id; item.Create_time = DateTime.Now; item.Descript = Descript; item.Email = Email; item.State = State; item.Tel = Tel; item.Telphone = Telphone; item.Wealth = Wealth; item = Order_refund.Insert(item); return(APIReturn.成功.SetData("item", item.ToBson())); }
public Order_refundInfo Save() { if (this.Id != null) { Order_refund.Update(this); return(this); } this.Create_time = DateTime.Now; return(Order_refund.Insert(this)); }
public ActionResult Edit([FromQuery] uint Id) { Order_refundInfo item = Order_refund.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 += Order_refund.Delete(id); } if (affrows > 0) { return(APIReturn.成功.SetMessage($"删除成功,影响行数:{affrows}")); } return(APIReturn.失败); }
public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Order_id, [FromForm] uint?Productitem_id, [FromForm] string Descript, [FromForm] string Email, [FromForm] string Img_url, [FromForm] IFormFile Img_url_file, [FromForm] Order_refundSTATE?State, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] decimal?Wealth) { Order_refundInfo item = Order_refund.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } if (!string.IsNullOrEmpty(item.Img_url) && (item.Img_url != Img_url || Img_url_file != null)) { string path = System.IO.Path.Combine(AppContext.BaseDirectory, item.Img_url); if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } } if (Img_url_file != null) { item.Img_url = $"/upload/{Guid.NewGuid().ToString()}.png"; using (FileStream fs = new FileStream(System.IO.Path.Combine(AppContext.BaseDirectory, item.Img_url), FileMode.Create)) Img_url_file.CopyTo(fs); } else { item.Img_url = Img_url; } item.Order_id = Order_id; item.Productitem_id = Productitem_id; item.Create_time = DateTime.Now; item.Descript = Descript; item.Email = Email; item.State = State; item.Tel = Tel; item.Telphone = Telphone; item.Wealth = Wealth; int affrows = Order_refund.Update(item); if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }
public Order_refundInfo AddOrder_refund(uint?Order_id, DateTime?Create_time, string Descript, string Email, string Img_url, Order_refundSTATE?State, string Tel, string Telphone, decimal?Wealth) => Order_refund.Insert(new Order_refundInfo { Order_id = Order_id, Productitem_id = this.Id, Create_time = Create_time, Descript = Descript, Email = Email, Img_url = Img_url, State = State, Tel = Tel, Telphone = Telphone, Wealth = Wealth });