コード例 #1
0
        public TM Execute(TM model)
        {
            ValidateRequest(model);
            var resource = _mapper.Map <TR>(model);

            if (model.Id != Guid.Empty && _getCommand.Execute(x => x.Where(y => y.Id == model.Id)) == null)
            {
                throw new ArgumentException("Id provided is invalid", model.Id.ToString());
            }

            OnBeforeSave(model, resource);

            _saveCommand.Execute(resource);
            return(_mapper.Map <TM>(resource));
        }
コード例 #2
0
 public Player[] Execute(Guid teamId)
 {
     return(_sqlCommand.Execute(x => x.Include(y => y.Player).Where(y => y.TeamId == teamId))
            .Select(x => _mapper.Map <Player>(x.Player)).ToArray());
 }
コード例 #3
0
 public TM Execute(Guid id)
 {
     return(_sqlCommand.Execute(x => x.Where(y => y.Id == id))
            .Select(x => _mapper.Map <TM>(x))
            .SingleOrDefault());
 }
コード例 #4
0
 public TM[] Execute()
 {
     return(SqlCommand.Execute(DbSetFunction()).Select(x => Mapper.Map <TM>(x)).ToArray());
 }