public async Task <IActionResult> CreateBookListing(CreateListingInputDto input, CancellationToken cancellationToken) { var mapped = _mapper.Map <ListingEntity>(input); _dbContext.Add(mapped); await _dbContext.SaveChangesAsync(cancellationToken); return(Ok(mapped.Id.ToResultModel())); }
public bool Post(EmailRegister model) { var result = _dbContext.Add(model).Entity; if (result != null) { return(true); } return(false); }
public async Task <IActionResult> Create([Bind("BrandId,Name")] Brand brand) { if (ModelState.IsValid) { _context.Add(brand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(brand)); }
public async Task <IActionResult> Create([Bind("Id,Name,Image")] Author author) { if (ModelState.IsValid) { _context.Add(author); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(author)); }
public async Task <IActionResult> Create([Bind("LanguageId,Name")] Language language) { if (ModelState.IsValid) { _context.Add(language); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(language)); }
public async Task <IActionResult> Create([Bind("Id,CommentString,BookId")] Comment comment) { if (ModelState.IsValid) { _context.Add(comment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Create))); } ViewData["BookId"] = new SelectList(_context.Books, "Id", "Name", comment.BookId); return(View(comment)); }
public async Task <IActionResult> Create([Bind("Id,AddressTitle,AddressDetails,UserId")] Address address) { if (ModelState.IsValid) { _context.Add(address); await _context.SaveChangesAsync(); return(Redirect("/Cart/PaymentDetail")); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", address.UserId); return(View(address)); }
public async Task <IActionResult> Create([Bind("Id,FullName,CartNo,Month,Year,CVV,UserId")] CreditCart creditCart) { if (ModelState.IsValid) { _context.Add(creditCart); await _context.SaveChangesAsync(); return(Redirect("/Cart/PaymentDetail")); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", creditCart.UserId); return(View(creditCart)); }
public async Task <IActionResult> Create([Bind("BookId,GenreId")] GenreBook genreBook) { if (ModelState.IsValid) { _context.Add(genreBook); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Books, "BookId", "Name", genreBook.BookId); ViewData["GenreId"] = new SelectList(_context.Genres, "GenreId", "Name", genreBook.GenreId); return(View(genreBook)); }
public bool Create(Section item) { try { _context.Add(item); _context.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public async Task <IActionResult> Create([Bind("BookId,AuthorId")] AuthorBook authorBook) { if (ModelState.IsValid) { _context.Add(authorBook); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AuthorId"] = new SelectList(_context.Authors, "AuthorId", "LastName", authorBook.AuthorId); ViewData["BookId"] = new SelectList(_context.Books, "BookId", "Name", authorBook.BookId); return(View(authorBook)); }
public async Task <IActionResult> Create([Bind("Id,Name,LastName,Email,UserName,Password,PhoneNumber,RoleId,GenderId")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(Redirect("/Account/Login")); } ViewData["GenderId"] = new SelectList(_context.Set <Gender>(), "Id", "Id", user.GenderId); ViewData["RoleId"] = new SelectList(_context.Set <Role>(), "Id", "Id", user.RoleId); return(View(user)); }
public async Task <IActionResult> Create([Bind("Id,Name,Image,Price,Content,PageNumber,Point,Rating,ReleaseDate,DiscountRate,SoldNumber,CategoryId,PublisherId,AuthorId")] Book book) { if (ModelState.IsValid) { _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AuthorId"] = new SelectList(_context.Author, "Id", "Id", book.AuthorId); ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Id", book.CategoryId); ViewData["PublisherId"] = new SelectList(_context.Publisher, "Id", "Id", book.PublisherId); return(View(book)); }