Example #1
0
        public async Task <ActionResult <Goiabinha> > PostGoiabinha(Goiabinha goiabinha)
        {
            _context.Goiabinha.Add(goiabinha);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGoiabinha", new { id = goiabinha.id }, goiabinha));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("id,nome,techLeader,horas,tickets")] Goiabinha goiabinha)
        {
            if (id != goiabinha.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(goiabinha);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GoiabinhaExists(goiabinha.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(goiabinha));
        }
Example #3
0
        public async Task <IActionResult> PutGoiabinha(int id, Goiabinha goiabinha)
        {
            if (id != goiabinha.id)
            {
                return(BadRequest());
            }

            _context.Entry(goiabinha).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GoiabinhaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("id,nome,techLeader,horas,tickets")] Goiabinha goiabinha)
        {
            if (ModelState.IsValid)
            {
                _context.Add(goiabinha);
                await _context.SaveChangesAsync();

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