public ActionResult DeleteConfirmed(int id) { CustomerDemand customerDemand = db.CustomerDemand.Find(id); db.CustomerDemand.Remove(customerDemand); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool Update(CustomerDemand item) { if (!string.IsNullOrWhiteSpace(item.Request)) { _uof.CustomerDemandRepository.Update(item); return(_uof.ApplyChange()); } return(false); }
public bool Delete(CustomerDemand item) { if (item != null) { _uof.CustomerDemandRepository.Delete(item); return(_uof.ApplyChange()); } return(false); }
/// <summary> /// 新增客源需求信息 /// </summary> /// <param name="customerDemand">实体</param> /// <param name="cancellationToken">验证</param> /// <returns></returns> public async Task <CustomerDemand> CreateAsync(CustomerDemand customerDemand, CancellationToken cancellationToken = default(CancellationToken)) { if (customerDemand == null) { throw new ArgumentNullException(nameof(customerDemand)); } Context.Add(customerDemand); await Context.SaveChangesAsync(cancellationToken); return(customerDemand); }
public ActionResult Edit([Bind(Include = "CustomerDemandId,CustomerId,Demand,DemandType")] CustomerDemand customerDemand) { if (ModelState.IsValid) { db.Entry(customerDemand).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProjectId = new SelectList(db.Project, "ProjectId", "Name", customerDemand.ProjectId); return(View(customerDemand)); }
public ActionResult Create([Bind(Include = "ProjectId,CustomerDemandId,CustomerId,Demand,DemandType")] CustomerDemand customerDemand) { if (ModelState.IsValid) { db.CustomerDemand.Add(customerDemand); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProjectId = new SelectList(db.Project, "ProjectId", "Name", customerDemand.ProjectId); return(View(customerDemand)); }
/// <summary> /// 修改客源需求信息 /// </summary> /// <param name="customerDemand"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task UpdateAsync(CustomerDemand customerDemand, CancellationToken cancellationToken = default(CancellationToken)) { if (customerDemand == null) { throw new ArgumentNullException(nameof(customerDemand)); } Context.Attach(customerDemand); Context.Update(customerDemand); try { await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateConcurrencyException) { } }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerDemand customerDemand = db.CustomerDemand.Find(id); if (customerDemand == null) { return(HttpNotFound()); } return(View(customerDemand)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerDemand customerDemand = db.CustomerDemand.Find(id); if (customerDemand == null) { return(HttpNotFound()); } ViewBag.ProjectId = new SelectList(db.Project, "ProjectId", "Name", customerDemand.ProjectId); return(View(customerDemand)); }