public ActionResult LeaveMessage(Guid FriendId, string MsgForFriend)
        {
            var currentUserId = new Guid(User.Identity.GetUserId());
            Profile currentUserProfile = db.UserProfiles.FirstOrDefault(x => x.AspNetUser_Id == currentUserId);
            Profile profileOfFriend = db.UserProfiles.FirstOrDefault(x => x.Id == FriendId);
            Status statusUpdate = new Status();

            if (String.IsNullOrWhiteSpace(MsgForFriend))
                return RedirectToAction("ShowFriends", new { id = currentUserProfile.Id });
            statusUpdate.StatusUpdate = MsgForFriend;
            statusUpdate.UpdatedByFullName = currentUserProfile.FullName;
            statusUpdate.UserWhomStatusBelongsTo = profileOfFriend.Id;
            statusUpdate.TimeOfUpdate = DateTime.Now;
            db.Statuses.Add(statusUpdate);
            db.SaveChanges();
            return RedirectToAction("ShowFriends", new { id = currentUserProfile.Id });
        }
        public ActionResult EditStatus(Guid? id, string statusUpdate)
        {
            if (id != null && !String.IsNullOrWhiteSpace(statusUpdate))
            {
                Status Update = new Status();
                var user = db.UserProfiles.Find(id);
                Update.StatusUpdate = statusUpdate;
                Update.UpdatedByFullName = user.FullName;
                Update.UserWhomStatusBelongsTo = user.Id;
                Update.TimeOfUpdate = DateTime.Now;

                db.Statuses.Add(Update);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(id);
        }
        // GET: /Profile/
        public ActionResult Index()
        {
            var currentUser = UserDB.Users.Find(User.Identity.GetUserId());
            if (currentUser.MadeProfileYet)
            {
                var vm = new ProfileStatus();
                vm.StatusList = new List<Status>();

                Guid UserId = new Guid(User.Identity.GetUserId());
                var profile = db.UserProfiles.FirstOrDefault(x => x.AspNetUser_Id == UserId);
                vm.Profile = profile;
                var listOfAllStatuses = db.Statuses.ToList();
                var listOfUserStatus = new List<Status>();
                foreach (Status x in listOfAllStatuses)
                {
                    if (x.UserWhomStatusBelongsTo == profile.Id) listOfUserStatus.Add(x);
                }

                foreach (var entry in listOfUserStatus)
                    vm.StatusList.Add(entry);
                if (vm.StatusList.Count == 0)
                {
                    Status firstStatus = new Status();
                    Profile aProfile= new Profile();
                    firstStatus.StatusUpdate = "Welcome!";
                    firstStatus.TimeOfUpdate = DateTime.Now;
                    firstStatus.UserWhomStatusBelongsTo = aProfile.AspNetUser_Id ;
                    firstStatus.UpdatedByFullName = aProfile.FullName;
                    db.Statuses.Add(firstStatus);
                    vm.StatusList.Add(firstStatus);
                    db.SaveChanges();
                    //vm.StatusList.Add(new Status { StatusUpdate = "Welcome!", UserWhomStatusBelongsTo = profile.Id, UpdatedByFullName = profile.FullName, TimeOfUpdate = DateTime.Now });
                }

                return View(vm);
            }
            else
                return RedirectToAction("CreateProfile");
        }
 public ActionResult PostStatus( string name)
 {
     Status status = new Status();
     status.StatusName = name;
     //status.Code = code;
     db.Status.Add(status);
     db.SaveChanges();
     return Json(true, JsonRequestBehavior.AllowGet);
 }