public ActionResult <string> Delete(string id) { try { return(Ok(_itemsService.Delete(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <String> Delete(int id) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return(Ok(_its.Delete(id, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void Delete_NoData_ReturnsNull() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "NoItems_Db_ForDelete") .Options; using (var context = new GameInfoContext(options)) { var service = new ItemsService(context); Assert.False(service.Delete(2)); } }
public ActionResult <string> Delete(int id) { try { string userId = HttpContext.User.FindFirstValue("Id"); return(Ok(_its.Delete(id, userId))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Item> Delete(int id) { try { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; // NOTE DONT TRUST THE USER TO TELL YOU WHO THEY ARE!!!! return(Ok(_ls.Delete(id, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <SuccessResponse> Delete(int id) { try { ItemsService service = new ItemsService(); service.Delete(id); SuccessResponse resp = new SuccessResponse(); return(Ok(resp)); } catch (Exception ex) { return(StatusCode(500, ex.Message.ToString())); } }
public void Delete_WithData_DeletesItem() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "Db_WithItems_ForDelete") .Options; using (var context = new GameInfoContext(options)) { context.Items.Add(new Item() { Name = "ToDelete", AcquiredFrom = "None", Usage = "None" }); context.SaveChanges(); } using (var context = new GameInfoContext(options)) { var service = new ItemsService(context); var result = service.Delete(1); Assert.True(result); Assert.Equal(0, context.Items.Count()); } }
public async Task <IActionResult> DeleteForm(string keyValue) { await itemsApp.Delete(keyValue); return(Success("删除成功。")); }
public void DeleteItemTest() { ItemsService itemsService = new ItemsService(); itemsService.Delete(14682, _customerTestFixture.CustomerId, _customerTestFixture.AccessToken); }
// GET: items/Delete/5 public ActionResult Delete(int id) { cos.Delete(cos.GetById(id)); return(RedirectToAction("Index")); }