public IHttpActionResult PostTaxiDrive(string senderID, [FromBody] TaxiDrive location) { return(Ok()); ////Customer ne pravi sam svoj nalog //if (senderID != customer.Username) //{ // AdminDbAccess dbAdmin = AdminDbAccess.Instance; // if (!LoggedUsers.Contains(senderID)) // { // return Content(HttpStatusCode.Unauthorized, "Not logged in."); // } // else if (!dbAdmin.Exists(senderID)) // { // return Content(HttpStatusCode.Unauthorized, "Not a dispatcher nor the user to be added."); // } //} //if (!ModelState.IsValid) //{ // return BadRequest(ModelState); //} //CustomerDbAccess dbCustomer = CustomerDbAccess.Instance; //bool result; //try //{ // result = dbCustomer.Add(customer); //} //catch (Exception e) //{ // Trace.Write($"Error on 'PostCustomer()'. Error message: {e.Message}"); // Trace.Write($"[STACK_TRACE] {e.StackTrace}"); // return InternalServerError(e); //} //if (result) //{ // return Ok(customer); //} //else //{ // return BadRequest("Customer already exists."); //} }
// PUT api/drivers/5 public IHttpActionResult PutTaxiDrive(string senderID, [FromBody] TaxiDrive location) { return(Ok()); //AdminDbAccess dbAdmin = AdminDbAccess.Instance; //DriverDbAccess dbDriver = DriverDbAccess.Instance; //bool result = false; //if (!LoggedUsers.Contains(senderID)) //{ // return Content(HttpStatusCode.Unauthorized, "Not logged in."); //} //if (dbDriver.Exists(driver.Username)) //{ // if (!dbAdmin.Exists(senderID) || senderID != driver.Username) // { // return Content(HttpStatusCode.Unauthorized, "Not a dispatcher nor a user to be modified."); // } // try // { // result = dbDriver.Modify(driver); // } // catch (Exception e) // { // Trace.Write($"Error on 'GetUser()'. Error message: {e.Message}"); // Trace.Write($"[STACK_TRACE] {e.StackTrace}"); // return InternalServerError(e); // } //} //if (result) //{ // return Ok(driver); //} //else //{ // return NotFound(); //} }