Beispiel #1
0
 public OperationResult<PaginatedList<Person>> GetAll(int pageIndex, int pageSize)
 {
     try {
         var people = repository.Paginate<Person>(pageIndex, pageSize);
         return new OperationResult<PaginatedList<Person>>(true, people);
     }
     catch (Exception exception)
     {
         var result = new OperationResult<PaginatedList<Person>>(false) { Message = exception.Message };
         result.Exceptions.Add(exception);
         return result;
     }
 }
Beispiel #2
0
 public OperationResult<Person> GetById(int personId)
 {
     try
     {
         var person = repository.GetSingle(personId);
         return new OperationResult<Person>(true, person);
     }
     catch (Exception exception)
     {
         var result = new OperationResult<Person>(false) { Message = exception.Message };
         result.Exceptions.Add(exception);
         return result;
     }
 }
Beispiel #3
0
 public OperationResult<Person> UpdateUser(Person person)
 {
     try
     {
         repository.Update(person);
         repository.Save();
         return new OperationResult<Person>(true, person);
     }
     catch (Exception exception)
     {
         var result = new OperationResult<Person>(false) { Message = exception.Message };
         result.Exceptions.Add(exception);
         return result;
     }
 }