/// <summary>
        /// Create a new room object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        /// <param name="facility_id">Initial value of the facility_id property.</param>
        /// <param name="name">Initial value of the name property.</param>
        /// <param name="add_date">Initial value of the add_date property.</param>
        public static room Createroom(global::System.Int32 id, global::System.Int32 facility_id, global::System.String name, global::System.DateTime add_date)
        {
            room room = new room();

            room.id          = id;
            room.facility_id = facility_id;
            room.name        = name;
            room.add_date    = add_date;
            return(room);
        }
Exemplo n.º 2
0
        // POST api/Room
        public HttpResponseMessage Postroom(room room)
        {
            if (ModelState.IsValid)
            {
                db.rooms.AddObject(room);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, room);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = room.id }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the rooms EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTorooms(room room)
 {
     base.AddObject("rooms", room);
 }
Exemplo n.º 4
0
        // PUT api/Room/5
        public HttpResponseMessage Putroom(int id, room room)
        {
            if (ModelState.IsValid && id == room.id)
            {
                db.rooms.Attach(room);
                db.ObjectStateManager.ChangeObjectState(room, EntityState.Modified);

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return Request.CreateResponse(HttpStatusCode.NotFound);
                }

                return Request.CreateResponse(HttpStatusCode.OK);
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the rooms EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTorooms(room room)
 {
     base.AddObject("rooms", room);
 }
 /// <summary>
 /// Create a new room object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="facility_id">Initial value of the facility_id property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="add_date">Initial value of the add_date property.</param>
 public static room Createroom(global::System.Int32 id, global::System.Int32 facility_id, global::System.String name, global::System.DateTime add_date)
 {
     room room = new room();
     room.id = id;
     room.facility_id = facility_id;
     room.name = name;
     room.add_date = add_date;
     return room;
 }