Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("StartDate,EndDate,Id")] Repertoire repertoire)
        {
            if (ModelState.IsValid)
            {
                _context.Add(repertoire);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(repertoire));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id")] FunZone funZone)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funZone);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(funZone));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Duration,Name,Description,ProjectionTypeString,Id")] Projection projection)
        {
            if (ModelState.IsValid)
            {
                _context.Add(projection);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(projection));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Price,Id")] Bid bid, int thematicPropId)
        {
            if (ModelState.IsValid)
            {
                var appUser = await _userManager.GetUserAsync(HttpContext.User);

                var prop = _context.ThematicProps.SingleOrDefault(x => x.Id == thematicPropId);
                bid.ThematicPropId = prop.Id;
                bid.User           = _context.UserProfiles.SingleOrDefault(x => x.Id == appUser.UserProfileId);
                if (prop.Price < bid.Price)
                {
                    prop.Price = bid.Price;
                }

                _context.Add(bid);
                _context.Update(prop);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bid));
        }