public ActionResult JoinDrawing(DashboardViewModel dashboardViewModel) { if (dashboardViewModel.JoinDrawingName != null && dashboardViewModel.JoinDrawingPassword != null) { DrawingDTO drawingToJoin = drawingRepository.ReadDrawingByName(dashboardViewModel.JoinDrawingName); if (drawingToJoin != null) { if (drawingToJoin.Password == dashboardViewModel.JoinDrawingPassword) { OpenDrawingViewModel vm = new OpenDrawingViewModel(); vm.Drawing = drawingToJoin; return(View("Drawing", vm)); } else { ModelState.AddModelError("RoomPasswordInvalid", "Wrong password!"); return(View("~/Views/Home/Dashboard.cshtml", dashboardViewModel)); } } else { ModelState.AddModelError("RoomMissing", "Room with name " + "'" + dashboardViewModel.JoinDrawingName + "'" + " doesn't exist!"); return(View("~/Views/Home/Dashboard.cshtml", dashboardViewModel)); } } else { ModelState.AddModelError("MissingParameters", "Please enter the room name and password,"); return(View("~/Views/Home/Dashboard.cshtml", dashboardViewModel)); } }