Exemple #1
0
        public ICommandResult Handle(DeleteRoadMapCommand command)
        {
            //Fail Fast Validation
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, Messages.Ex_ExceptionGeneric, command.Notifications));
            }

            var roadMap = _repository.GetById(command.Id);

            if (roadMap == null)
            {
                return(new GenericCommandResult(false, Messages.Ex_ItemNotFound.ToFormat(command.Id.ToString() ?? ""), command.Notifications));
            }

            _repository.Delete(roadMap);

            return(new GenericCommandResult(true, Messages.Act_Deleted, roadMap));
        }
Exemple #2
0
 public GenericCommandResult Delete([FromBody] DeleteRoadMapCommand command, [FromServices] RoadMapHandler handler)
 {
     return((GenericCommandResult)handler.Handle(command));
 }