public ActionResult Details(int id) { Book book = IBook.Get(id); if (book == null) { ErrorModel error = new ErrorModel(); error.Name = "Cannot find the book"; error.Description = "There is error on finding the book in our library."; return new ErrorController().Catch(error); } return View(book); }
public ActionResult Reply(ReplyModel model) { if (!ModelState.IsValid) { ErrorModel error = new ErrorModel() { Name = "Invalid Reply", Description = "The data inserted in the fields is not valid. Please fill the data correctly." }; return new ErrorController().Catch(error); } Reply reply = new DataAccess.Reply(); reply.Comment = model.Comment; reply.Email = model.Email; reply.Name = model.Name; reply.Website = model.Website; IReply.Create(reply); MailMessenger.SendMessage(reply.Email, "You have left a reply on the site of Shotlekov books.", "Reply"); MailMessenger.SendMessage(MailMessenger.MyEmail, "Reply from " + reply.Name + ": " + reply.Comment, "Reply"); return RedirectToAction("Replies", "Resource"); }
public ActionResult Catch(ErrorModel model) { return View(model); }