Exemplo n.º 1
0
        public async Task <WebsiteOption> MakeAsync(CreateWebsiteOptionDto model)
        {
            model.CheckArgumentIsNull(nameof(model));
            var entity = model.Adapt <WebsiteOption>();

            entity.WebsiteId = _websiteInfo.Id;

            return(await Task.FromResult(
                       entity));
        }
Exemplo n.º 2
0
        public async Task<WebsiteOptionResultDto> CreateOrUpdateAsync(
            CreateWebsiteOptionDto model) {
            var entity = await _repository.GetOptionAsync(
                model.Category,
                model.Key,
                model.LangId) ?? await _factory.MakeAsync(model);

            if (entity.Id != 0)
                _repository.MarkForUpdate(entity);
            else
                _repository.MarkForAdd(entity);

            await _repository.SaveChangesAsync();

            return await Task.FromResult(
                entity.Adapt<WebsiteOptionResultDto>()
            );
        }