public ActionResult Save(AllocateClassRoom allocateClassRoom) { if (allocateClassRoom.FromTime.Length == 7) { allocateClassRoom.FromTime = "0" + allocateClassRoom.FromTime; } if (allocateClassRoom.ToTime.Length == 7) { allocateClassRoom.ToTime = "0" + allocateClassRoom.ToTime; } if (ModelState.IsValid) { ViewBag.Departments = allocateClassRoomManager.GetDepartmentsForDropdown(); ViewBag.Rooms = allocateClassRoomManager.GetRoomForDropdown(); ViewBag.WeekDays = allocateClassRoomManager.GetWeekDaysForDropdown(); ViewBag.Message = allocateClassRoomManager.saveAllocateClass(allocateClassRoom); return(View()); } else { ViewBag.Departments = allocateClassRoomManager.GetDepartmentsForDropdown(); ViewBag.Rooms = allocateClassRoomManager.GetRoomForDropdown(); ViewBag.WeekDays = allocateClassRoomManager.GetWeekDaysForDropdown(); string message = "Validation Error"; ViewBag.Message = message; return(View()); } }