Пример #1
0
        //Get: user/profile
        public ActionResult GetProfile()
        {
            int userId = Convert.ToInt32(Session["UserId"]);

            try
            {
                //bool result = int.TryParse(Session["UserId"], out userId);
                //if (result)
                //{
                var result = _userProfileRepo.CheckuserProfileExists(userId);
                if (result)
                {
                    var profile = _userProfileRepo.GetUserProfile(userId);
                    return(View(profile));
                }
                else
                {
                    return(RedirectToAction("AddProfile"));
                }

                //}
            }
            catch (Exception e)
            {
                return(View());
            }
            return(View());
        }
Пример #2
0
 public IHttpActionResult CheckUserProfileAdded([FromUri(Name = "UserId")] int id)
 {
     try
     {
         var result = _userProfile.CheckuserProfileExists(id);
         return(Ok <bool>(result));
     }
     catch (Exception e)
     {
         //throw;
         return(BadRequest());
     }
 }