Пример #1
0
 public ActionResult Edit([Bind(Include = "Id,Text")] EditLabelBindingModel label)
 {
     if (ModelState.IsValid)
     {
         this.service.EditLabel(label);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Пример #2
0
        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();
        }