Пример #1
0
        public JsonResult SaveImageWithTheUserID(string imageURL)
        {
            FormsAuthenticationTicket ticket = null;

            try
            {
                _UserDetailsBusinessLogic = new UserDetailsBusinessLogic();

                HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
                ticket = FormsAuthentication.Decrypt(authCookie.Value);
                int userId = 0;
                if (redirectedUserId == 0)
                {
                    userId = _UserDetailsBusinessLogic.GetUserID(ticket.Name);
                }
                else
                {
                    userId = redirectedUserId;
                }

                var isSaved = _UserDetailsBusinessLogic.SaveImageWithTheUserID(imageURL, userId);

                return(Json(isSaved));
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex);
                return(Json(false));
            }
        }