public void UpdateMemberRole(Gang gang, Character member, GangRole newRole) { var res = Db.Query().CommandText("update gangmembers set role = @newRole where gangid = @gangId and memberid = @memberId") .SetParameter("@gangId", gang.Id) .SetParameter("@memberId", member.Id) .SetParameter("@newRole", (int)newRole) .ExecuteNonQuery(); if (res == 0) { throw new PerpetuumException(ErrorCodes.SQLUpdateError); } }
public void Insert(Gang gang) { var res = Db.Query().CommandText("insert into gang (id,leaderid,name) values (@id,@leaderId,@name)") .SetParameter("@id", gang.Id) .SetParameter("@leaderId", gang.Leader.Id) .SetParameter("@name", gang.Name) .ExecuteNonQuery(); if (res == 0) { throw new PerpetuumException(ErrorCodes.SQLInsertError); } foreach (var member in gang.GetMembers()) { InsertMember(gang, member); } }
public void Update(Gang item) { throw new NotImplementedException(); }