Example #1
0
 public DraftTable CreateDraftFromModel(TableModel model)
 {
     return new DraftTable()
     {
         Name = this.Name,
         Capacity = this.Capacity,
         TableNumber = this.TableNumber
     };
 }
Example #2
0
 public ActionResult Create(TableModel model)
 {
     if (ModelState.IsValid)
     {
         this.publishingService.CreateDraft(model.CreateDraftFromModel(model), null);
         return RedirectToAction("Index");
     }
     else
     {
         return View();
     }
 }
Example #3
0
 public ActionResult Edit(TableModel model)
 {
     if (ModelState.IsValid)
     {
         if (model.IsDraft)
         {
             var draft = this.publishingService.GetDraftById(model.ID);
             this.publishingService.UpdateDraft(model.UpdateDraftFromModel(draft));
         }
         else
         {
             var table = this.publishingService.GetByID(model.ID);
             this.publishingService.CreateDraft(model.UpdateDraftFromModel(new DraftTable()), table);
         }
         return RedirectToAction("Index");
     }
     else
     {
         return View();
     }
 }