public async Task <IActionResult> CreateAsync(VicReviewViewModel vicovee) { if (!this.ModelState.IsValid) { return(this.View(vicovee)); } // var result = await this.roleManager.CreateAsync(new ApplicationRole // { // Name = "Admin", // }); // var user = await this.userManager.GetUserAsync(this.User); // var acc = new Account() // { // CreatedOn = DateTime.UtcNow, // User = user.UserName, // }; // var check = this.accRepo.All() // .FirstOrDefault(x => x.User == acc.User); // if (check == null) // { // await this.accRepo.AddAsync(acc); // await this.accRepo.SaveChangesAsync(); // } // var user = await this.userManager.GetUserAsync(this.User); // await this.userManager.AddToRoleAsync(user, "Admin"); var vicove = new VicForReview() { Content = vicovee.Content, VicType = vicovee.VicType, CreatedOn = DateTime.UtcNow, Creator = this.User.Identity.Name, DateTime = DateTime.UtcNow, User = this.User.Identity.Name, }; await this.vicReviewRepository.AddAsync(vicove); await this.vicReviewRepository.SaveChangesAsync(); return(this.RedirectToPage("/Home")); }
public IActionResult Create() { var model = new VicReviewViewModel(); return(this.View(model)); }