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"); } }
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)); }