public void Create(ProjectModel project)
 {
     using (_repository = _getRepository())
     {
         _repository.Insert(project);
         _repository.Save();
     }
 }
 public void AddUser(Models.UserProfile toAdd)
 {
     using (_userProfileRepository = _userProfileRepositoryInitializer())
     {
         _userProfileRepository.Insert(Mapper.Map<Models.UserProfile, UserProfile>(toAdd));
         _userProfileRepository.Save();
     }
 }
Exemple #3
0
 public void Create(SlotModel slot)
 {
     using (_repository = _getRepository())
     {
         _repository.Insert(slot);
         _repository.Save();
     }
 }
 public void Remove(int id)
 {
     using (_repository = _getRepository())
     {
         _repository.Remove(id);
         _repository.Save();
     }
 }
Exemple #5
0
 public void Create(TaskModel task)
 {
     using (_repository = _getRepository())
     {
         _repository.Insert(task);
         _repository.Save();
     }
 }
 public void SetSalt(int userId, string salt)
 {
     using (_repository = _getRepository())
     {
         MembershipModel membership = _repository.Get(userId);
         membership.PasswordSalt = salt;
         _repository.Update(membership);
         _repository.Save();
     }
 }
Exemple #7
0
 public void InitializeRoles()
 {
     using (_repository = _getRepository())
     {
         if (!_repository.Get().Any())
         {
             _repository.Insert(new RoleModel { RoleName = "admin" });
             _repository.Insert(new RoleModel { RoleName = "user" });
             _repository.Save();
         }
     }
 }
 public void InitializeCategories()
 {
     using (_repository = _getRepository())
     {
         if (!_repository.Get().Any())
         {
             _repository.Insert(new CategoryModel { Name = "Easy" });
             _repository.Insert(new CategoryModel { Name = "Difficult" });
             _repository.Save();
         }
     }
 }
Exemple #9
0
 public void Update(SlotModel slot)
 {
     using (_repository = _getRepository())
     {
         SlotModel toUpdate = _repository.Get(item => item.Id == slot.Id).First();
         toUpdate.Name = slot.Name;
         toUpdate.StartDate = slot.StartDate;
         toUpdate.FinishDate = slot.FinishDate;
         toUpdate.TaskId = slot.TaskId;
         _repository.Update(toUpdate);
         _repository.Save();
     }
 }
Exemple #10
0
 public void InitializeTypes()
 {
     using (_repository = _getRepository())
     {
         if (!_repository.Get().Any())
         {
             _repository.Insert(new TypeModel { Name = "Epic" });
             _repository.Insert(new TypeModel { Name = "Task" });
             _repository.Insert(new TypeModel { Name = "Bug" });
             _repository.Insert(new TypeModel { Name = "Exception" });
             _repository.Save();
         }
     }
 }
 public void InitializePriorities()
 {
     using (_repository = _getRepository())
     {
         if (!_repository.Get().Any())
         {
             _repository.Insert(new PriorityModel { Name = "Low" });
             _repository.Insert(new PriorityModel { Name = "Medium" });
             _repository.Insert(new PriorityModel { Name = "High" });
             _repository.Insert(new PriorityModel { Name = "Very high" });
             _repository.Save();
         }
     }
 }
 public void InitializeStatuses()
 {
     using (_repository = _getRepository())
     {
         if (!_repository.Get().Any())
         {
             _repository.Insert(new StatusModel { Name = "Active" });
             _repository.Insert(new StatusModel { Name = "Completed" });
             _repository.Insert(new StatusModel { Name = "Suspended" });
             _repository.Insert(new StatusModel { Name = "New" });
             _repository.Insert(new StatusModel { Name = "Reactivated" });
             _repository.Save();
         }
     }
 }
Exemple #13
0
 public void Update(UserModel user)
 {
     using (_repository = _getRepository())
     {
         UserModel toUpdate = _repository.Get(item => item.UserId == user.UserId, item => item.webpages_Roles).First();
         toUpdate.UserName = user.UserName;
         int roleId = user.webpages_Roles.First().RoleId;
         toUpdate.webpages_Roles.Clear();
         toUpdate.webpages_Roles.Add(
             _repository.GetAnother<Model.RoleModel>(item => item.RoleId == roleId).First()
         );
         _repository.Update(toUpdate);
         _repository.Save();
     }
 }
Exemple #14
0
 public void UpdateCreated(UserModel user)
 {
     using (_repository = _getRepository())
     {
         UserModel toUpdate = _repository.Get(item => item.UserName.Equals(user.UserName)).First();
         int roleId = user.webpages_Roles.First().RoleId;
         toUpdate.webpages_Roles = new []
             {
                 _repository.GetAnother<Model.RoleModel>(item => item.RoleId == roleId).First()
             };
         _repository.Update(toUpdate);
         _repository.Save();
     }
 }
Exemple #15
0
 public void Update(TaskModel task)
 {
     using (_repository = _getRepository())
     {
         TaskModel toUpdate = _repository.Get(item => item.Id == task.Id).First();
         toUpdate.Name = task.Name;
         toUpdate.Description = task.Description;
         toUpdate.TimeEstimate = task.TimeEstimate;
         toUpdate.StartDate = task.StartDate;
         toUpdate.FinishDate = task.FinishDate;
         toUpdate.Filepath = task.Filepath;
         toUpdate.Version = task.Version;
         toUpdate.ProjectId = task.ProjectId;
         toUpdate.AssignedPersonId = task.AssignedPersonId;
         toUpdate.AssigningPersonId = task.AssigningPersonId;
         toUpdate.CategoryId = task.CategoryId;
         toUpdate.StatusId = task.StatusId;
         toUpdate.PriorityId = task.PriorityId;
         toUpdate.TypeId = task.TypeId;
         _repository.Update(toUpdate);
         _repository.Save();
     }
 }
 public void Update(ProjectModel project)
 {
     using (_repository = _getRepository())
     {
         ProjectModel toUpdate = _repository.Get(item => item.Id == project.Id).First();
         toUpdate.Name = project.Name;
         _repository.Update(toUpdate);
         _repository.Save();
     }
 }
 public void UpdateMembership(Models.webpages_Membership toUpdate)
 {
     using (_membershipRepository = _membershipRepositoryInitializer())
     {
         _membershipRepository.Update(Mapper.Map<Models.webpages_Membership, webpages_Membership>(toUpdate));
         _membershipRepository.Save();
     }
 }