public IActionResult Get(int id) { Dpg dpg = _context.Dpg.FirstOrDefault(d => d.DpgId == id); if (dpg == null) { return(NotFound()); } return(Json(dpg)); }
public IActionResult Add(Dpg dpg) { if (dpg == null) { return(BadRequest("Empty body.")); } _context.Dpg.Add(dpg); _context.SaveChanges(); return(Ok(dpg)); }