Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("OnlineVendorId,VendorName,OnDate,IsActive,Remark,OffDate,Reason")] OnlineVendor onlineVendor)
        {
            if (id != onlineVendor.OnlineVendorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(onlineVendor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OnlineVendorExists(onlineVendor.OnlineVendorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView(onlineVendor));
        }
Esempio n. 2
0
        public async Task <ActionResult <OnlineVendor> > PostOnlineVendor(OnlineVendor onlineVendor)
        {
            _context.OnlineVendors.Add(onlineVendor);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetOnlineVendor", new { id = onlineVendor.OnlineVendorId }, onlineVendor));
        }
Esempio n. 3
0
        public async Task <IActionResult> PutOnlineVendor(int id, OnlineVendor onlineVendor)
        {
            if (id != onlineVendor.OnlineVendorId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("OnlineVendorId,VendorName,OnDate,IsActive,Remark,OffDate,Reason")] OnlineVendor onlineVendor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(onlineVendor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView(onlineVendor));
        }