public ActionResult Edit( Project project)
        {
            var editproject = _unitOfWork.ProjectRepository.GetById(project.Id);
            editproject.Body = project.Body;
            editproject.Comment = project.Comment;
            editproject.Name = project.Name;
            editproject.LastModifyTime = DateTime.Now;

            if (editproject.CurrentResponseUser.Id != User.Identity.GetUserId()) { return HttpNotFound(); }

            if (ModelState.IsValid)
            {
                foreach (var projectComponent in project.ProjectComponents)
                {
                    if (projectComponent.Id == Guid.Empty)
                    {
                        var temp = new ProjectComponent
                        {
                            Id = Guid.NewGuid(),
                            Project = editproject,
                            Component = _unitOfWork.ComponentRepository.GetById(projectComponent.Component.Id),
                            Count = Convert.ToInt32(projectComponent.Count)
                        };
                        _unitOfWork.ProjectComponentRepository.Insert(temp);
                        //break;
                    }
                    else
                    {
                        var proj = _unitOfWork.ProjectComponentRepository.GetById(projectComponent.Id);
                        if (projectComponent.Count == -1)
                        {
                            _unitOfWork.ProjectComponentRepository.Delete(proj);
                        }
                        else
                        {
                            proj.Count = projectComponent.Count;
                            proj.Component = _unitOfWork.ComponentRepository.GetById(projectComponent.Component.Id);
                            _unitOfWork.ProjectComponentRepository.Update(proj);
                        }
                    }
                }
                _unitOfWork.ProjectRepository.Update(editproject);
                _unitOfWork.Save();
                return RedirectToAction("Index", new { id = User.Identity.GetUserId() });
            }
            ViewBag.ListOfComponent = _unitOfWork.ComponentRepository.Get().ToList();
            PopulateComponentDropDown();
            return View(editproject);
        }
        public ActionResult Create(TemporalClass temporal)
        {
            if (ModelState.IsValid)
            {
                temporal.Project.Id = Guid.NewGuid();

                temporal.Project.CreatingTime = DateTime.Now;
                temporal.Project.LastModifyTime = DateTime.Now;

                var iduser = User.Identity.GetUserId();

                temporal.Project.CreatingUser = _unitOfWork.ApplicationUserRepository.GetById(iduser);
                temporal.Project.CurrentResponseUser = _unitOfWork.ApplicationUserRepository.GetById(iduser);

                if (temporal.ProjectComponents != null)
                {
                    foreach (var project in temporal.ProjectComponents)
                    {
                        if (project.CountView != "-1")
                        {
                            var temp = new ProjectComponent
                            {
                                Id = Guid.NewGuid(),
                                Project = temporal.Project,
                                Component = _unitOfWork.ComponentRepository.GetById(new Guid(project.ComponentId)),
                                Count = Convert.ToInt32(project.CountView)
                            };
                            _unitOfWork.ProjectComponentRepository.Insert(temp);
                        }
                    }
                }
                _unitOfWork.ProjectRepository.Insert(temporal.Project);
                _unitOfWork.Save();
                return RedirectToAction("Index",new{id=iduser});
            }

            PopulateComponentDropDown();

            return View(temporal);
        }