public IHttpActionResult BuildingInsert(string name = null, string sittings = "1", string build_name = null) { try { int sittings_number = Int32.Parse(sittings.Trim()); BLRooms rooms = new BLRooms(); var room = rooms.Insert(name, sittings_number, build_name); return(Ok(new RoomsVM(room))); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult BuildingDetail(string name = null) { try { BLRooms rooms = new BLRooms(); var room_detail = rooms.GetDetail(name); //Return a ResourceVM Object mapped from Resource return(Ok(new RoomsVM(room_detail))); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult All() { try { BLRooms rooms = new BLRooms(); var room_list = rooms.All(); RoomsVM obj = new RoomsVM(); return(Ok(obj.CreateList(room_list))); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult BuildingDelete(string room_name) { try { BLRooms rooms = new BLRooms(); var result = rooms.Delete(room_name); //if (result > 0) //{ // return Ok(result); //} //else //{ // return NotFound(); //} return(Ok("Build deleted")); } catch (Exception ex) { return(InternalServerError(ex)); } }