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)); }
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()); }
public TM Execute(Guid id) { return(_sqlCommand.Execute(x => x.Where(y => y.Id == id)) .Select(x => _mapper.Map <TM>(x)) .SingleOrDefault()); }
public TM[] Execute() { return(SqlCommand.Execute(DbSetFunction()).Select(x => Mapper.Map <TM>(x)).ToArray()); }