コード例 #1
0
 public ActionResult newComment(int maintenanceId, string commentTitle, string commentBody)
 {
     if (!authorize()) { return RedirectToAction("authError", "Error"); }
     MaintenanceUpdate comment = new MaintenanceUpdate
     {
         associatedEventId = maintenanceId,
         body = commentBody,
         isCommentOnBike = false,
         postedById = context.BikeUser.Where(u => u.userName == User.Identity.Name).First().bikeUserId,
         timePosted = DateTime.Now,
         title = commentTitle
     };
     context.MaintenanceUpdate.Add(comment);
     context.SaveChanges();
     return RedirectToAction("MaintenanceDetails", "Mechanic", new { maintId = maintenanceId });
 }
コード例 #2
0
 public ActionResult newComment(int maintId)
 {
     if (!authorize()) { return RedirectToAction("authError", "Error"); }
     var model = new MaintenanceUpdate();
     model.associatedEventId = maintId;
     return View(model);
 }