public RepositoryEntity Create(RepositoryEntity repositoryEntity) { Repositories repository = repositoryEntity.ToModel(); smartDeliveryContext.Repositories.Add(repository); smartDeliveryContext.SaveChanges(); return(new RepositoryEntity(repository)); }
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)); }
public RepositoryEntity Update(Guid repositoryId, [FromBody] RepositoryEntity repositoryEntity) { return(repositoryService.Update(repositoryId, repositoryEntity)); }
public RepositoryEntity Create([FromBody] RepositoryEntity repositoryEntity) { return(repositoryService.Create(repositoryEntity)); }