public async Task <User> GetById(Int64 userId) { var _param = new DynamicParameters(); _param.Add("@oUserId", userId, DbType.Int64); return(await Task.FromResult(_dapperService.Get <User>("API_GetUserById", _param, CommandType.StoredProcedure))); }
public ActionResult Index() { var sb = new StringBuilder("Dapper service\n"); int usersBefore = _repo.GetUsers().Count; sb.Append($"Users before: {usersBefore}\n"); var user = new User { Age = 18, Email = "*****@*****.**", IsMarried = false, Name = "some123", Sex = "male" }; _repo.Create(user); sb.Append($"Create user: {user.Id}\n"); int usersAfter = _repo.GetUsers().Count; sb.Append($"Users after: {usersAfter}\n"); user.Name = "Username123"; _repo.Update(user); User dbUser = _repo.Get(user.Id); sb.Append($"Update user: {dbUser.Name}\n"); _repo.Delete(dbUser.Id); sb.Append("Delete user\n"); int usersAfterDel = _repo.GetUsers().Count; sb.Append($"Users after delete: {usersAfterDel}\n"); return(Content(sb.ToString())); }
public async Task <Item> GetById(int itemId) { var result = await Task.FromResult(_dapper.Get <Item>($"select * from Item i inner join Player p on p.PlayerId = {itemId} where i.ItemId = {itemId}", null, commandType: CommandType.Text)); return(result); }
public async Task <Monster> GetById(int monsterId) { var result = await Task.FromResult(_dapper.Get <Monster>($"select * from Monster where MonsterId = {monsterId}", null, commandType: CommandType.Text)); return(result); }
public Event GetById(int eventId) { var result = _dapper.Get <Event>($"select * from Event where EventId = {eventId}", null, commandType: CommandType.Text); return(result); }
public async Task <Zone> GetById(int ZoneId) { var result = await Task.FromResult(_dapper.Get <Zone>($"select * from Zone z inner join Monster m on m.ZoneId = {ZoneId} where ZoneId = {ZoneId}", null, commandType: CommandType.Text)); return(result); }
public Task <Teams> GetById(int id) { var teams = Task.FromResult(_dapperService.Get <Teams>($"select * from [Teams] where TeamID = {id}", null, commandType: CommandType.Text)); return(teams); }
public async Task <Quest> GetById(int QuestId) { var result = await Task.FromResult(_dapper.Get <Quest>($"select * from Quest q where q.QuestId = {QuestId}", null, commandType: CommandType.Text)); return(result); }
public async Task <Player> GetById(int Id) { var result = await Task.FromResult(_dapper.Get <Player>($"Select * from [Player] where PlayerId = {Id}", null, commandType: CommandType.Text)); return(result); }
public async Task <Npc> GetById(int NpcId) { var result = await Task.FromResult(_dapper.Get <Npc>($"select * from Npc where NpcId = {NpcId}", null, commandType: CommandType.Text)); return(result); }