Esempio n. 1
0
        public async Task <IActionResult> PutTODOTask(int id, TODOTask tODOTask)
        {
            if (id != tODOTask.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutUserDetails(int id, UserDetails userDetails)
        {
            if (id != userDetails.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 3
0
 public void Update(TODOItem todo)
 {
     using (TODOContext db = new TODOContext())
     {
         db.Todos.Attach(todo);
         db.Entry(todo).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "ListID,Title,Date")] List list)
 {
     if (ModelState.IsValid)
     {
         db.Entry(list).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(list));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "ID,title,Image,Date")] TODO1 tODO1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tODO1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tODO1));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "TaskID,TaskName,Description,IsDone,Date,ListID")] Task task)
 {
     if (ModelState.IsValid)
     {
         db.Entry(task).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ListID = new SelectList(db.Lists, "ListID", "Title", task.ListID);
     return(View(task));
 }