public ActionResult RoomAllocation(RoomAllocation roomAllocation) { ViewBag.Message = roomAllocationSaveManager.SaveRoomAllocation(roomAllocation); List<Department> departmentsList = departmentManager.GetDepartmentsList(); List<Room> roomList = roomManager.GetRoomList(); ViewBag.departmentsList = departmentsList; ViewBag.roomList = roomList; return View(); }
public int SaveRoomAllocte(RoomAllocation roomAllocation) { connection.ConnectionString = connectionString; string sqlQuery = "INSERT INTO roomAllocation_tbl VALUES('" + roomAllocation.DepartmentId + "','" + roomAllocation.CourseId + "','" + roomAllocation.RoomNo + "','" + roomAllocation.DayList + "','" + roomAllocation.FromTime + " " + roomAllocation.FromExtension + "','" + roomAllocation.ToTime + " " + roomAllocation.ToExtension + "',1)"; SqlCommand command = new SqlCommand(sqlQuery, connection); connection.Open(); int isInserted = command.ExecuteNonQuery(); connection.Close(); return isInserted; }
public string SaveRoomAllocation(RoomAllocation roomAllocation) { if (roomAllocationSaveGatway.SaveRoomAllocte(roomAllocation) > 0) { return "Allocation Successfull ."; } else { return "Allocation Failed"; } }