Zbiór zmian 839 dla branches/Abonament/Wierszowki/Wierszowki.Services
- Data:
- 2009-09-30 16:24:43 (17 years ago)
- Lokalizacja:
- branches/Abonament
- Pliki:
-
- 4 zmodyfikowane
-
. (zmodyfikowane) (1 prop)
-
Wierszowki/Wierszowki.Services/AuthorService.cs (zmodyfikowane) (2 diffs)
-
Wierszowki/Wierszowki.Services/MagazineItemService.cs (zmodyfikowane) (5 diffs)
-
Wierszowki/Wierszowki.Services/UserService.cs (zmodyfikowane) (1 diff)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
branches/Abonament
- Property svn:mergeinfo
-
old new 1 /branches/AutoShopper:815-818 1 2 /branches/ReklamaReorganizacja:568-731 2 /trunk:708-758,760-809 3 /tags/BazaReklam_1.1.28:831 4 /trunk:708-758,760-838
-
- Property svn:mergeinfo
-
branches/Abonament/Wierszowki/Wierszowki.Services/AuthorService.cs
r752 r839 8 8 namespace Wierszowki.Services 9 9 { 10 10 11 public class AuthorService : BaseService 11 12 { … … 15 16 if (errors.Any()) 16 17 throw new RulesException(errors); 17 18 18 19 var authorToUpdate = DataContext.GetAuthorById(author.Id); 19 20 authorToUpdate.FirstName = author.FirstName; 20 21 authorToUpdate.LastName = author.LastName; 21 22 authorToUpdate.EmploymentTypeId = author.EmploymentTypeId; 22 DataContext.SubmitChanges(); 23 DataContext.SubmitChanges(); 23 24 } 24 25 -
branches/Abonament/Wierszowki/Wierszowki.Services/MagazineItemService.cs
r752 r839 28 28 public MagazineItem Find(int id) 29 29 { 30 return _repository.Find(id).Single ();30 return _repository.Find(id).SingleOrDefault(); 31 31 } 32 32 … … 35 35 var errors = DataAnnotationsValidationRunner.GetErrors(magazineItem); 36 36 if (errors.Any()) 37 { 37 38 throw new RulesException(errors); 39 } 40 var errors1 = new List<ErrorInfo>(); 41 errors1 = ShowError(magazineItem); 42 if (errors1.Count() > 0) throw new RulesException(errors1.AsEnumerable()); 38 43 39 44 var user = _userRepository.FindOne(u => u.Login == currentUser); … … 43 48 magazineItem.UpdatedBy = user.Id; 44 49 magazineItem.UpdatedOn = now; 50 51 _repository.Insert(magazineItem); 52 53 } 45 54 46 _repository.Insert(magazineItem); 55 private List<ErrorInfo> ShowError(MagazineItem magazineItem) 56 { 57 var errors1 = new List<ErrorInfo>(); 58 if (magazineItem.IssueId <= 0) 59 { 60 ErrorInfo e1 = new ErrorInfo("Magazine", "Proszę wybrać gazetę!"); 61 errors1.Add(e1); 62 ErrorInfo e = new ErrorInfo("IssueId", "Proszę wybrać numer wydania!"); 63 errors1.Add(e); 64 } 65 return errors1; 47 66 } 48 67 … … 53 72 throw new RulesException(errors); 54 73 74 var errors1 = new List<ErrorInfo>(); 75 errors1 = ShowError(magazineItem); 76 if (errors1.Count() > 0) throw new RulesException(errors1.AsEnumerable()); 77 78 55 79 var user = _userRepository.FindOne(u => u.Login == currentUser); 56 80 var now = DateTime.Now; 57 81 58 var magazineItemToUpdate = _repository.FindOne(magazineItem.Id); 82 var magazineItemToUpdate = _repository.FindOne(magazineItem.Id); 59 83 magazineItemToUpdate.AuthorId = magazineItem.AuthorId; 60 84 magazineItemToUpdate.Bonus = magazineItem.Bonus; … … 70 94 _repository.Update(magazineItemToUpdate); 71 95 } 96 public void Delete(MagazineItem magazineItem) 97 { 98 var magazineItemToDelete = _repository.FindOne(magazineItem.Id); 99 if (magazineItemToDelete != null) 100 { 101 _repository.Delete(magazineItemToDelete); 102 } 103 } 72 104 } 73 105 } -
branches/Abonament/Wierszowki/Wierszowki.Services/UserService.cs
r752 r839 65 65 public User Find(int id) 66 66 { 67 return _repository.Find(id).Single ();67 return _repository.Find(id).SingleOrDefault(); 68 68 } 69 69
