Beispiel #1
0
 public ActionResult Create(ReviewModel model)
 {
     if (ModelState.IsValid)
     {
         PublicationStatus statusRascunho = this.publicationStatusRepository.GetByName(Constants.PublicationStatusName.DRAFT);
         var draft = model.CreateDraftReviewFromModel(this.productService.GetByID(model.ProductId), null);
         this.publishingService.CreateDraft(draft,draft.OriginReview);
         return RedirectToAction("Index");
     }
     SetarViewBag();
     return View();
 }
Beispiel #2
0
 public ActionResult Edit(int id, bool isDraft)
 {
     if (!isDraft)
     {
         ReviewModel model = new ReviewModel(this.publishingService.GetByID(id));
         SetarViewBag(model.ProductId);
         return View(model);
     }
     else
     {
         ReviewModel model = new ReviewModel(this.publishingService.GetDraftById(id),isDraft);
         SetarViewBag(model.ProductId);
         return View(model);
     }
 }
Beispiel #3
0
 public ActionResult Edit(ReviewModel model)
 {
     if (ModelState.IsValid)
     {
         if (!model.IsDraft)
         {
             var produto = this.productService.GetByID(model.ProductId);
             Review origin = this.publishingService.GetByID(model.ID);
             DraftReview d = model.CreateDraftReviewFromModel(this.productService.GetByID(model.ProductId), origin);
             this.publishingService.CreateDraft(d,origin);
         }
         else
         {
             var produto = this.productService.GetByID(model.ID);
             Review origin = this.publishingService.GetByID(model.IdOriginal);
             this.publishingService.UpdateDraft(model.PopularDraftReviewFromModel(this.publishingService.GetDraftById(model.ID), this.productService.GetByID(model.ProductId)));
         }
     }
     SetarViewBag();
     return RedirectToAction("Index");
 }