Пример #1
0
        public ICancelingTemplateModel Save(ICancelingTemplateModel model)
        {
            var template = model.Map <CancellingTemplate>();

            template.Id = Guid.NewGuid();

            repository.Save(template);
            return(GetById(template.Id));
        }
Пример #2
0
        private Dictionary <Guid, string> GetCancelingReasons(List <JobStatusLog> logs)
        {
            var result = new Dictionary <Guid, string>();
            IEnumerable <Guid>             cancelingIds = logs.Select(x => x.CancellingId.Value).Distinct();
            List <ICancelingTemplateModel> templates    = cancelingTemplatesService.GetByIds(cancelingIds).ToList();

            foreach (var log in logs)
            {
                ICancelingTemplateModel template = templates.FirstOrDefault(t => t.Id == log.CancellingId);

                result.Add(log.Id, template?.Text);
            }

            return(result);
        }