Пример #1
0
        public ActionResult Edit(OrderNote item)
        {
            if (ModelState.IsValid)
            {
                db.Entry(item).State = EntityState.Modified;
            }

            return RedirectToAction("edit", "orders", new { id = item.OrderId });
        }
Пример #2
0
 public ActionResult Create(OrderNote item)
 {
     if (ModelState.IsValid)
     {
         db.OrderNotes.Add(item);
         return RedirectToAction("edit", "orders", new { id = item.OrderId });
     }
     else
     {
         return View();
     }
 }
Пример #3
0
        public ActionResult Create(FormCollection form)
        {
            var note = new OrderNote();
            TryUpdateModel<OrderNote>(note);
            try
            {
                db.OrderNotes.Add(note);
                var notes = db.OrderNotes.Where(x => x.OrderId == note.OrderId).OrderBy(x => x.CreatedOn);
                return Json(new { success = true, message = "Note added", notes = notes });
            }
            catch
            {

                return Json(new { success = true, message = "There was an error adding this note"});
            }
        }