public ActionResult Edit([Bind(Include = "Id,Text")] EditLabelBindingModel label) { if (ModelState.IsValid) { this.service.EditLabel(label); return(RedirectToAction("Index")); } return(View()); }
public void EditLabel(EditLabelBindingModel label) { Label targetLabel = this.FindLabel(label.Id); if (targetLabel == null) { throw new NullReferenceException("The Label is not found"); } targetLabel.Text = label.Text; this.Context.SaveChanges(); }