public ActionResult Delivery() { DeliveryVM dvm = new DeliveryVM(); var LoggedUserID = User.Identity.GetUserId(); dvm.buildinguser = db.BuildingUser.Where(c => c.UserID == LoggedUserID).FirstOrDefault(); dvm.ApatList = db.Apartment.Where(c => c.BuildingID == dvm.buildinguser.BuildingID).Select(c => new SelectListItem { Text = c.ApartmentNumber, Value= c.ID.ToString() }).ToList(); dvm.PackageType = db.PackageType.Select(c=> new SelectListItem{ Text = c.PackageType1, Value=c.ID.ToString()}).ToList(); dvm.carrierService = db.ShippingCarrier.Select(c => new SelectListItem { Text = c.Services, Value=c.ID.ToString() }).ToList(); dvm.shippingService = db.ShippingService.Select(c => new SelectListItem {Text = c.Service, Value = c.ID.ToString() }).ToList(); return View(dvm); }
public ActionResult Delivery(DeliveryVM model, string Name) { //if user is not found in the directory then the form should be filled out in the UI if (model.otheruser != null) { Otherusers newUser = new Otherusers(); newUser = model.otheruser; ApplicationDbContext context = new ApplicationDbContext(); var RoleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(context)); var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(context)); string password = PasswordGenerator.GeneratePassword("8").ToString(); var UserID = RegisterUsers.InsertUser(newUser.Email, newUser.Phone, password); var result = RegisterUsers.InserToRole("Otheruser", UserID); //TODO: register OtherUsers in db. //TODO: create table in db first. } return View(); }