Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Petition,EventType,Place,EventDate,NAssistants,Details,Name,phone,Email")] Event @event)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@event);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Done)));
            }
            return(View(@event));
        }
Ejemplo n.º 2
0
        public IActionResult Contact(Quotes model)
        {
            //ViewData["Message"] = "Your contact page.";
            if (ModelState.IsValid)
            {
                _context.Add(model);
                _context.SaveChanges();
                var quotes = _context.Quotes.ToList();
                return(View("Index", quotes));
            }

            return(View(model));
        }
Ejemplo n.º 3
0
        public IActionResult Create([FromBody] Quotes quote)
        {
            if (quote == null)
            {
                return(BadRequest());
            }


            _context.Add(quote);
            _context.SaveChanges();

            return(CreatedAtRoute("GetQuotes", new { id = quote.Id }, quote));
        }