private void validate(topicDTO ntopic) { if (string.IsNullOrEmpty(ntopic.Topic_Name)) { throw new ArgumentException("Topic_Name must consist value!"); } }
public void AddStreet(topicDTO ntopic) { var user = SecurityContext.GetUser(); var userType = user.GetType(); if (userType != typeof(Admin) || userType != typeof(Moder)) { throw new MethodAccessException(); } if (ntopic == null) { throw new ArgumentNullException(nameof(ntopic)); } validate(ntopic); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <topicDTO, topic>()).CreateMapper(); var topicEntity = mapper.Map <topicDTO, topic>(ntopic); _database.topics.Create(topicEntity); }