Пример #1
0
        public RepositoryEntity Create(RepositoryEntity repositoryEntity)
        {
            Repositories repository = repositoryEntity.ToModel();

            smartDeliveryContext.Repositories.Add(repository);
            smartDeliveryContext.SaveChanges();
            return(new RepositoryEntity(repository));
        }
Пример #2
0
        public RepositoryEntity Update(Guid repositoryId, RepositoryEntity repositoryEntity)
        {
            Repositories repository = smartDeliveryContext.Repositories.Where(m => m.Id == repositoryId)
                                      .Include(u => u.Cabinet)
                                      .FirstOrDefault();

            if (repository == null)
            {
                throw new BadRequestException("Repository khong ton tai");
            }
            repositoryEntity.ToModel(repository);
            smartDeliveryContext.Repositories.Update(repository);
            smartDeliveryContext.SaveChanges();
            return(new RepositoryEntity(repository));
        }
Пример #3
0
 public RepositoryEntity Update(Guid repositoryId, [FromBody] RepositoryEntity repositoryEntity)
 {
     return(repositoryService.Update(repositoryId, repositoryEntity));
 }
Пример #4
0
 public RepositoryEntity Create([FromBody] RepositoryEntity repositoryEntity)
 {
     return(repositoryService.Create(repositoryEntity));
 }