Esempio n. 1
0
        public async Task Update(AreaTopicServiceModel model)
        {
            var topic = await _topicService.GetByIdAsync(model.Id);

            ValidateUser(topic.UserId);

            await _topicService.UpdateAsync(model);
        }
Esempio n. 2
0
        public async Task UpdateAsync(AreaTopicServiceModel model)
        {
            using (_unitOfWork)
            {
                var topic = await _areaTopicReadRepository.GetByIdAsync(model.Id);

                if (topic == null)
                {
                    throw new DomainServicesException("Topic not found.");
                }

                topic.Name      = model.Name;
                topic.StartDate = DateTime.ParseExact(model.StartDate, "yyyy-MM-dd",
                                                      CultureInfo.CurrentCulture);
                topic.EndDate = DateTime.ParseExact(model.EndDate, "yyyy-MM-dd",
                                                    CultureInfo.CurrentCulture);
                topic.Source      = model.Source;
                topic.Description = model.Description;

                await _unitOfWork.CommitAsync();
            }
        }
Esempio n. 3
0
        public async Task UpdateAsync(AreaTopicServiceModel model)
        {
            var topic = await _topicObjectService.GetByIdAsync <AreaTopic>(model.Id);

            if (topic == null)
            {
                throw new DomainServicesException("Topic not found.");
            }

            topic.Name = model.Name;
            if (!model.IsTemplate && !string.IsNullOrEmpty(model.StartDate) && !string.IsNullOrEmpty(model.EndDate))
            {
                topic.StartDate = DateTime.ParseExact(model.StartDate, "yyyy-MM-dd",
                                                      CultureInfo.CurrentCulture);
                topic.EndDate = DateTime.ParseExact(model.EndDate, "yyyy-MM-dd",
                                                    CultureInfo.CurrentCulture);
            }

            topic.Source      = model.Source;
            topic.Description = model.Description;

            await _topicObjectService.UpdateAsync(topic);
        }