Esempio n. 1
0
 public bool DeleteElf(Guid id)
 {
     if (id == Guid.Empty)
     {
         throw ValidationExceptionFactory.Create(ServerMessages.Error_IdNotProvided, nameof(id));
     }
     return(_elvesEngine.DeleteElf(id));
 }
Esempio n. 2
0
 public ElfBO[] SearchWithFilters(string search)
 {
     if (string.IsNullOrEmpty(search))
     {
         throw ValidationExceptionFactory.Create(ServerMessages.Error_SearchStringProvided, nameof(search));
     }
     return(_elvesEngine.SearchWithFilters(search));
 }
Esempio n. 3
0
 public bool CreateElf(ElfBO elf)
 {
     if (string.IsNullOrEmpty(elf.Name))
     {
         throw ValidationExceptionFactory.Create(ServerMessages.Error_NameNotProvided, nameof(elf.Name));
     }
     return(_elvesEngine.CreateElf(elf));
 }
 public virtual TEntity Save(TEntity entity)
 {
     try
     {
         var state = entity.Id.Equals(default(TId)) ? EntityState.Added : EntityState.Modified;
         RepositoryContext.DbContext.Entry(entity).State = state;
         RepositoryContext.Save();
         return entity;
     }
     catch (DbEntityValidationException e)
     {
         throw ValidationExceptionFactory.GetException(e);
     }
 }