public EmailResult AddToProject(UserViewModel user, string message)
 {
     From = "*****@*****.**";
     To.Add(user.Email);
     Subject = "New Task on Task Manager";
     return Email("StatusChanges",message);
 }
 // GET: Mail
 public EmailResult NewTask(UserViewModel user,string message)
 {
     From = "*****@*****.**";
     To.Add(user.Email);
     Subject = "New Task on Task Manager";
     return Email("NewTask",message);
 }
        public UserEntity ToBllUser(UserViewModel user)
        {
            
            var profile = profileService.GetProfileByUserId(user.Id);
            if(profile==null)
            {
                profileService.CreateProfile(profile = new ProfileEntity()
                {
                    FirstName = user.FirstName,
                    LastName = user.LastName,
                    UserId = user.Id
                });
            }
            else
            {
                profile.FirstName = user.FirstName;
                profile.LastName = user.LastName;
                profileService.UpdateProfile(profile);            
            }

            return new UserEntity()
            {
                Id = user.Id,
                Email = user.Email,
                RoleId =(int)user.Role
            };
        }
        public ActionResult Delete(UserViewModel user)
        {
            try
            {
                userService.DeleteUser(userMapper.ToBllUser(user));

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(UserViewModel user)
        {
            try
            {
                if (ModelState.IsValid)
                   userService.UpdateUser(userMapper.ToBllUser(user));

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
 public ArticleViewModel(string Content,DateTime CreationDateTime,UserViewModel Author=null)
 {
     this.Content = Content;
     this.CreationDateTime = CreationDateTime;
     this.Author = Author;
 }