public async Task <IActionResult> Create(CatalogsCreateViewModel model) { if (ModelState.IsValid) { var catalog = new Catalog() { Id = Guid.NewGuid().ToString(), Name = model.Name, Description = model.Descritpion, MyUserId = _dbContext.Users.Where(x => x.NormalizedUserName == model.MyUser_UserName.ToUpper()).FirstOrDefault().Id }; await _dbContext.Catalogs.AddAsync(catalog); await _dbContext.SaveChangesAsync(); return(Redirect("/Catalog")); } return(View(model)); }
public IActionResult Create() { var model = new CatalogsCreateViewModel(); return(View(model)); }