public ActionResult PostEmployee([FromBody] OfficerDataIn value) { var session = Guid.NewGuid().ToString(); if (value == null || string.IsNullOrWhiteSpace(value.Name)) { return(BadRequest(Utils.GetResponse(session))); } var result = workdb.CreateOfficerInfo(value, session); return(CreatedAtAction(nameof(GetOfficerByID), new { id = result }, result)); }
public ActionResult Put(int id, [FromBody] OfficerDataIn value) { var session = Guid.NewGuid().ToString(); if (value == null || id < 0 || string.IsNullOrWhiteSpace(value.Name)) { return(BadRequest(Utils.GetResponse(session))); } var off = workdb.GetOfficerInfoByID(id, session); if (off == null || off.ID < 0) { return(NotFound(Utils.GetResponse(session))); } workdb.UpdateOfficer(id, value, session); return(Ok(Utils.GetResponse(session))); }