public HttpResponseMessage PostUniversity([FromBody] UNIVERSITY uni) { try { using (TECAirlinesDBEntities entities = new TECAirlinesDBEntities()) { entities.UNIVERSITies.Add(uni); //entities.INSERT_UNIVERSITY(uni.UNIVERSITY_NAME); entities.SaveChanges(); var message = Request.CreateResponse(HttpStatusCode.Created, uni); message.Headers.Location = new Uri(Request.RequestUri + uni.UNIVERSITY_ID.ToString()); return(message); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public HttpResponseMessage PostClient([FromBody] RESERVATION reservation) { try { using (TECAirlinesDBEntities entities = new TECAirlinesDBEntities()) { entities.INSERT_RESERVATION(reservation.TICKET_COUNT, reservation.LUGGAGE_COUNT, reservation.SEATS, reservation.CHECKIN, reservation.T_TYPE, reservation.PRICE, reservation.CLIENT_ID, reservation.FLIGHT_ID); entities.SaveChanges(); var message = Request.CreateResponse(HttpStatusCode.Created, reservation); message.Headers.Location = new Uri(Request.RequestUri + reservation.RESERVATION_ID.ToString()); return(message); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public HttpResponseMessage PostClient([FromBody] CLIENT client) { try { using (TECAirlinesDBEntities entities = new TECAirlinesDBEntities()) { entities.INSERT_CLIENT(client.CLIENT_ID, client.CLIENT_FNAME, client.CLIENT_LNAME, client.CLIENT_UID, client.CLIENT_PHONENO, en.EncryptDecrypt(client.CLIENT_CARDNO, 200), client.CLIENT_MILES, client.CLIENT_EMAIL, client.CLIENT_PASSWRD, client.UNIVERSITY_ID); entities.SaveChanges(); var message = Request.CreateResponse(HttpStatusCode.Created, client); message.Headers.Location = new Uri(Request.RequestUri + client.CLIENT_ID); return(message); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }