Exemple #1
0
 public void Create(CreateCommentViewModel model)
 {
     var userModel = new UserModel();
     using (var db = new DBEntitiesProxy())
     {
         db.COMMENT.Add(new COMMENT()
         {
             Content = model.Content,
             PlaceId = model.PlaceId,
             Date = System.DateTime.Now,
             UserId = userModel.GetUserID(model.UserEmail)
         });
         db.SaveChanges();
     }
 }
 public ActionResult Create(CreateCommentViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             commentModel.Create(model);
         }
         return RedirectToAction("Index", "Home");
     }
     catch
     {
         return View(model);
     }
     return View(model);
 }