public ActionResult ModuleAdd(int BuildingID)
 {
     
     PendingModules ObjModule = new PendingModules();
     ObjModule.BuildingID = BuildingID;
     ViewBag.ListOfModules = db.ListOfModule.Select(c => new SelectListItem { Text = c.ModuleName, Value= c.ID.ToString()}).ToList();
     return View(ObjModule);
 }
 public ActionResult ModuleAdd(PendingModules model, int BuildingID)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     model.ServiceName = db.ListOfModule.Find(model.ListOfModuleID).ModuleName;
     var HasSomething = db.Module.Where(m=>m.BuildingID==BuildingID).Any(m=>m.ListOfModuleID == model.ListOfModuleID);
     if (HasSomething)
     {
         ViewBag.DuplicateMessage =model.ServiceName + " already exist and connot be added. Please select a different service and click send for approval.";
         ViewBag.ListOfModules = db.ListOfModule.Select(c => new SelectListItem { Text = c.ModuleName, Value = c.ID.ToString() }).ToList();
         return View(model);
         //return RedirectToAction("ModuleAdd",new {BuildingID=BuildingID});
     }
    
     db.PendingModules.Add(model);
     db.SaveChanges();
     return RedirectToAction("buildingProfile", "building", new { BuildingID = BuildingID });
 }