Example #1
0
        public async Task <IActionResult> PutVegeDetails(long id, VegeDetails vegeDetails)
        {
            if (id != vegeDetails.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <VegeDetails> > PostVegeDetails(VegeDetails vegeDetails)
        {
            _context.VegeDetails.Add(vegeDetails);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVegeDetails", new { id = vegeDetails.Id }, vegeDetails));
        }
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            VegeDetails = await _context.VegeDetails.FirstOrDefaultAsync(m => m.Id == id);

            if (VegeDetails == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            VegeDetails = await _context.VegeDetails.FindAsync(id);

            if (VegeDetails != null)
            {
                _context.VegeDetails.Remove(VegeDetails);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }