예제 #1
0
        public void MakeChancellery(ChancelleryDTO chancelleryDto, string authorEmail)
        {
            var Author = Database.Employees.Find(u => u.Email == authorEmail).FirstOrDefault();

            if (Author == null)
            {
                throw new ValidationException("Не возможно идентифицировать текущего пользователя по почте", authorEmail);
            }
            try
            {
                var         mapper      = new MapperConfiguration(cfg => cfg.CreateMap <ChancelleryDTO, Chancellery>()).CreateMapper();
                Chancellery Chancellery = mapper.Map <ChancelleryDTO, Chancellery>(chancelleryDto);


                Database.Chancelleries.Create(Chancellery);
                Database.Save();
            }
            catch (Exception e)
            {
                Debug.WriteLine("Имя члена:               {0}", e.TargetSite);
                Debug.WriteLine("Класс определяющий член: {0}", e.TargetSite.DeclaringType);
                Debug.WriteLine("Тип члена:               {0}", e.TargetSite.MemberType);
                Debug.WriteLine("Message:                 {0}", e.Message);
                Debug.WriteLine("Source:                  {0}", e.Source);
                Debug.WriteLine("Help Link:               {0}", e.HelpLink);
                Debug.WriteLine("Stack:                   {0}", e.StackTrace);

                foreach (DictionaryEntry de in e.Data)
                {
                    Console.WriteLine("{0} : {1}", de.Key, de.Value);
                }
            }
        }
예제 #2
0
 public void UpdateChancellery(ChancelleryDTO chancelleryDto, string authorEmail)
 {
     throw new NotImplementedException();
 }