public void DeleteItem(ArchiveDTO archiveDTO) { /*if (userDTO.Id <= 0) * throw new ValidationException("Wrong or empty property Id"); * uof.Users.Delete(userDTO.Id); * uof.Save();*/ }
public void UpdateItem(ArchiveDTO archiveDTO) { if (archiveDTO.Id <= 0) { throw new ValidationException("Wrong or empty properties"); } var archiveDAL = uof.PassingRecords.GetItem(archiveDTO.Id); if (archiveDAL == null) { throw new ValidationException("Item not found"); } if (archiveDTO.TestId > 0) { var testDAL = uof.Tests.GetItem(archiveDTO.TestId); if (testDAL == null) { throw new ValidationException("Test not found"); } archiveDAL.TestId = archiveDTO.TestId; } if (archiveDTO.UserId > 0) { var UserDAL = uof.Users.GetItem(archiveDTO.UserId); if (UserDAL == null) { throw new ValidationException("User not found"); } archiveDAL.UserId = archiveDTO.UserId; } uof.PassingRecords.Update(archiveDAL); uof.Save(); }
public void AddItem(ArchiveDTO archiveDTO) { if (archiveDTO.TestId <= 0 || archiveDTO.UserId <= 0) { throw new ValidationException("Wrong or empty properties"); } var testDAL = uof.Tests.GetItem(archiveDTO.TestId); if (testDAL == null) { throw new ValidationException("Test not found"); } var userDAL = uof.Users.GetItem(archiveDTO.UserId); if (userDAL == null) { throw new ValidationException("User not found"); } var archiveDAL = MapperBLL.Mapper.Map <Archive>(archiveDTO); uof.PassingRecords.Create(archiveDAL); uof.Save(); }