Ejemplo n.º 1
0
        public void Create(CommentAdd newComment, int id, double lat, double lng)
        {
            try
            {
                if (!HttpContext.User.Identity.IsAuthenticated)
                {
                    RedirectToAction("Login", "Account");
                }
                if (!ModelState.IsValid)
                {
                    RedirectToAction("Index", "Home");
                }
                newComment.LocationId = id;
                m.LocationAddComment(newComment);

                var geoCoord = new UserGeoLocation
                {
                    Latitude  = lat,
                    Longitude = lng,
                };


                //return RedirectToAction("Index", "Home");
            }
            catch
            {
                RedirectToAction("Index", "Home");
            }
        }
Ejemplo n.º 2
0
        public CommentAdd LocationAddComment(CommentAdd newComment)
        {
            var addComment = ds.Comments.Add(mapper.Map <Comment>(newComment));

            addComment.UserName = HttpContext.Current.User.Identity.Name;
            ds.SaveChanges();
            return((addComment == null) ? null : mapper.Map <CommentAdd>(addComment));
        }