public ActionResult <string> GetEmpById(int id) { PR_Mgr pm = new PR_Mgr(); DataTable dt = pm.GetEmpByID(id); string json = JsonConvert.SerializeObject(dt, Formatting.Indented); return(json); //todo: just return emp? }
public ActionResult <string> GetEmps() { // return "test abc"; DataTable dt = new PR_Mgr().GetEmps(); string json = JsonConvert.SerializeObject(dt, Formatting.Indented); return(json); }
public async Task <IActionResult> Put(int id, [FromBody] string value) { //todo: chk if modified? here? using (PR_Mgr mgr = new PR_Mgr()) { Emp emp = JsonConvert.DeserializeObject <Emp>(value); await mgr.EmpUpdate(emp); } return(NoContent()); }
public void Post(int id, [FromBody] string value) { using (PR_Mgr mgr = new PR_Mgr()) { Emp emp = JsonConvert.DeserializeObject <Emp>(value); mgr.EmpInsert(emp); } //todo: should something be returned? CreatedAtAction and for Put /* * _context.ToDoItems.Add(item); * await _context.SaveChangesAsync(); * return CreatedAtAction(nameof(GetTodoItem), new { id = item.id }, item); */ }