Пример #1
0
        public async Task <IActionResult> PutEntry(int id, Entry entry)
        {
            if (id != entry.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Name,Field1_Name,Field2_Name,Field3_Name,Field4_Name,Field5_Name,Field6_Name,Field7_Name,Field8_Name")] Channel channel)
        {
            var user = _usrMgr.GetUserAsync(User).Result;

            if (ModelState.IsValid)
            {
                channel.UserId = user.Id;
                _context.Add(channel);
                await _context.SaveChangesAsync();

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

            return(View(channel));
        }