예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email,Address,Title,Type,Description")] Overview overview)
        {
            if (id != overview.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(overview);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OverviewExists(overview.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(overview));
        }
예제 #2
0
 public Overview createNewOverview(Person p, Todolist l)
 {
     if (p != null && l != null)
     {
         Overview o = new Overview();
         o.Id = p.Id; o.Name = p.Name; o.Email = p.Email; o.Address = p.Address; o.Title = l.Title; o.Type = l.Type; o.Description = l.Description;
         return(o);
     }
     return(null);
 }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,Address,Title,Type,Description")] Overview overview)
        {
            if (ModelState.IsValid)
            {
                _context.Add(overview);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(overview));
        }
예제 #4
0
        public IActionResult CreateList(int pid)
        {
            Person   p = GetPerson(pid);
            Todolist l = GetList(1);
            Overview o = createNewOverview(p, l);

            if (ModelState.IsValid)
            {
                _context.Add(o);
            }
            return(View(o));
        }