public async Task <Response> Insert(User item) { try { using var context = _db; await context.Users.AddAsync(item); await context.SaveChangesAsync(); return(await ResponseModels.SuccessResponseModel()); } catch (Exception e) { return(await ResponseModels.FailedResponseModel(e.ToString())); } }
public async Task <Response> Delete(int id) { try { using var context = _db; context .Users .Remove(new User() { Id = id }); await context.SaveChangesAsync(); return(await ResponseModels.SuccessResponseModel()); } catch (Exception e) { return(await ResponseModels.FailedResponseModel(e.ToString())); } }