public async static Task <Weapon> Add(Weapon w, StatContext context) { await context.AddAsync(w); await context.SaveChangesAsync(); return(w); }
public async static Task <Weapon> Edit(Weapon w, StatContext context) { await context.AddAsync(w); context.Entry(w).State = EntityState.Modified; await context.SaveChangesAsync(); return(w); }
public async static Task Delete(int id, StatContext context) { Weapon w = await GetWeaponById(id, context); if (w != null) { await context.AddAsync(w); context.Entry(w).State = EntityState.Deleted; await context.SaveChangesAsync(); } }