Пример #1
0
        public ICommandResult Execute(CreateOrUpdateFabricanteCommand command)
        {
            Fabricante _Fabricante = AutoMapper.Mapper.Map <CreateOrUpdateFabricanteCommand, Fabricante>(command);

            if (command.Id == 0)
            {
                FabricanteRepository.Add(_Fabricante);
            }
            else
            {
                FabricanteRepository.Update(_Fabricante);
            }
            unitOfWork.Commit();

            AutoMapper.Mapper.Map <Fabricante, CreateOrUpdateFabricanteCommand>(_Fabricante, command);

            return(new CommandResult(true));
        }