Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Account_id,Camera_id,Lens_id,Publish_date,Title,Pulse")] Post post)
        {
            if (ModelState.IsValid)
            {
                _context.Add(post);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(post));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Manufacturer,Model,Min_ISO,Max_ISO,Mounting_id")] Camera camera)
        {
            if (ModelState.IsValid)
            {
                _context.Add(camera);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(camera));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Mounting mounting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mounting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(mounting));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,Username,Fullname,Country")] Account account)
        {
            if (ModelState.IsValid)
            {
                _context.Add(account);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(account));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id,Manufacturer,Model,Aperture,Min_focal_length,Max_focal_length,Mounting_id")] Lens lens)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lens);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(lens));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,Country")] Author author)
        {
            if (ModelState.IsValid)
            {
                _context.Add(author);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(author));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("Id,Title,ISBN,Price,Category,AuthorId")] Book book)
        {
            if (ModelState.IsValid)
            {
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AuthorId"] = new SelectList(_context.Author, "Id", "Name", book.AuthorId);
            return(View(book));
        }