예제 #1
0
        public ActionResult PostDetails(Comment comment, ICreateService service, IDetailService serviceDetail)
        {
            if (!ModelState.IsValid)
            {
                //model errors so return immediately
                return(View(new DetailPostViewModels
                {
                    Comment = comment,
                    DetailPostDto = serviceDetail.GetDetail <DetailPostDto>(comment.PostId).Result
                }));
            }

            var response = service.Create(comment);

            if (response.IsValid)
            {
                TempData["message"] = response.SuccessMessage;
                return(RedirectToAction("PostDetails"));
            }

            //else errors, so copy the errors over to the ModelState and return to view
            response.CopyErrorsToModelState(ModelState, comment);
            return(View(new DetailPostViewModels
            {
                Comment = comment,
                DetailPostDto = serviceDetail.GetDetail <DetailPostDto>(comment.PostId).Result
            }));
        }
예제 #2
0
 public ActionResult PostDetails(int id, IDetailService service)
 {
     return(View(new DetailPostViewModels
     {
         Comment = new Comment(),
         DetailPostDto = service.GetDetail <DetailPostDto>(id).Result
     }));
 }
 public ActionResult Details(int id, IDetailService service)
 {
     return(View(service.GetDetail <CrudCustomerDto>(id).Result));
 }
예제 #4
0
 public ActionResult Details(int id, IDetailService service)
 {
     return(View(service.GetDetail <DetailPostDto>(id).Result));
 }
예제 #5
0
 public ActionResult Details(int id, IDetailService service)
 {
     return View(service.GetDetail<Tag>(id).Result);
 }
 public ActionResult Details(int id, IDetailService service)
 {
     return View(service.GetDetail<CrudSalesOrderDto>(id).Result);
 }