public async Task <IActionResult> Create([Bind("Id,CreatedBy,Created,Updated,UpdatedBy,Active,Tags,Comments,FirstName,MiddleName,LastName,Title,LocationId,ImageId")] Contact contact) { if (ModelState.IsValid) { contact.Id = Guid.NewGuid(); _context.Add(contact); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CreatedBy"] = new SelectList(_context.User, "Id", "UserName", contact.CreatedBy); ViewData["ImageId"] = new SelectList(_context.Image, "Id", "Id", contact.ImageId); ViewData["LocationId"] = new SelectList(_context.Location, "Id", "AddressLine1", contact.LocationId); ViewData["UpdatedBy"] = new SelectList(_context.User, "Id", "UserName", contact.UpdatedBy); return(View(contact)); }
public async Task <IActionResult> Create([Bind("Id,CreatedBy,Created,Updated,UpdatedBy,Active,Tags,Comments,Name,LocationId,SubAreaId")] Community community) { if (ModelState.IsValid) { community.Id = Guid.NewGuid(); _context.Add(community); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CreatedBy"] = new SelectList(_context.User, "Id", "UserName", community.CreatedBy); ViewData["LocationId"] = new SelectList(_context.Location, "Id", "AddressLine1", community.LocationId); ViewData["SubAreaId"] = new SelectList(_context.SubArea, "Id", "Name", community.SubAreaId); ViewData["UpdatedBy"] = new SelectList(_context.User, "Id", "UserName", community.UpdatedBy); return(View(community)); }