コード例 #1
0
        public ActionResult Like(int id, IUpdateSetupService serviceSetup, IUpdateService serviceUpdate)
        {
            var dto = serviceSetup.GetOriginal <DetailPostDto>(id).Result;

            if (!ModelState.IsValid)
            {
                //model errors so return immediately
                return(View(serviceUpdate.ResetDto(dto)));
            }

            // increase the number of likes
            dto.Likes++;

            var response = serviceUpdate.Update(dto);

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

            //else errors, so copy the errors over to the ModelState and return to view
            response.CopyErrorsToModelState(ModelState, dto);
            return(View(dto));
        }
コード例 #2
0
 public ActionResult Edit(int id, IUpdateSetupService service)
 {
     return(View(service.GetOriginal <CrudCustomerDto>(id).Result));
 }
コード例 #3
0
 public ActionResult EditAddress(int customerId, int addressId, IUpdateSetupService service)
 {
     return(View(service.GetOriginal <CrudCustomerAddressDto>(customerId, addressId).Result));
 }
コード例 #4
0
 public ActionResult Edit(int id, IUpdateSetupService service)
 {
     return(View(service.GetOriginal <DetailPostDto>(id).Result));
 }
コード例 #5
0
 public ActionResult Edit(int id, IUpdateSetupService service)
 {
     return View(service.GetOriginal<Blog>(id).Result);
 }
コード例 #6
0
 public ActionResult Edit(int id, IUpdateSetupService service)
 {
     return View(service.GetOriginal<CrudSalesOrderDto>(id).Result);
 }
コード例 #7
0
 public ActionResult EditAddress(int customerId, int addressId, IUpdateSetupService service)
 {
     return View(service.GetOriginal<CrudCustomerAddressDto>(customerId, addressId).Result);
 }