public Mark Create(CreateMarkCommand command)
        {
            var service = new Mark(command.Term, command.Job, command.Description);

            service.Validate();
            _repository.Create(service);

            if (Commit())
            {
                return(service);
            }

            return(null);
        }
Пример #2
0
        public IActionResult Create([FromRoute] long dictid, [FromBody] CreateMarkCommand command)
        {
            command.DictionaryId = dictid;
            var result = _commandBus.Send(command);

            if (!result.IsValid())
            {
                var Error = (InvalidResult)result;
                return(BadRequest(Error.Errors));
            }

            long dictionaryId = command.DictionaryId;

            return(RedirectToAction("Get", new { id = dictionaryId }));
        }