Beispiel #1
0
        public async Task <ActionResult <Inquiryoffice> > PostInquiryoffice(Inquiryoffice inquiryoffice)
        {
            _context.Inquiryoffices.Add(inquiryoffice);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetInquiryoffice", new { id = inquiryoffice.InquiryId }, inquiryoffice));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("InquiryId,FoodName,Question,Answer")] Inquiryoffice inquiryoffice)
        {
            if (id != inquiryoffice.InquiryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inquiryoffice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InquiryofficeExists(inquiryoffice.InquiryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(inquiryoffice));
        }
Beispiel #3
0
        public async Task <IActionResult> PutInquiryoffice(int id, Inquiryoffice inquiryoffice)
        {
            if (id != inquiryoffice.InquiryId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("InquiryId,FoodName,Question,Answer")] Inquiryoffice inquiryoffice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inquiryoffice);
                await _context.SaveChangesAsync();

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