public IActionResult AddSubTask(EachTask newTask) { newTask.UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value; if (ModelState.IsValid) //changes parent class ID field to true { EachTask newParentTask = _context.Task.Find(newTask.ParentTaskId); newParentTask.Parent = true; _context.Entry(newParentTask).State = Microsoft.EntityFrameworkCore.EntityState.Modified; //remember to copy paste this honkin thing _context.Update(newParentTask); _context.SaveChanges(); } if (ModelState.IsValid) //adds child class { _context.Task.Add(newTask); _context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View()); } }
public ActionResult Edit([Bind(Include = "Id,UserId,Description,DueDate,TimeLeft,Complete")] Task task) { if (ModelState.IsValid) { db.Entry(task).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } HttpCookie userId = HttpContext.Request.Cookies[Constant.UserIdCookie]; ViewBag.UserId = int.Parse(userId.Value); //ViewBag.UserId = new SelectList(db.Users, "Id", "FirstName", task.UserId); return(View(task)); }
public async Task <IActionResult> PutUser(int id, User user) { if (id != user.Id) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tasks> > PutTask(int id, Tasks task) { if (id != task.Id) { return(BadRequest()); } _context.Entry(task).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(id)) { return(NotFound()); } else { throw; } } return(task); }
public async Task <ActionResult <Categories> > PutCategories(int id, Categories categories) { if (id != categories.Id) { return(BadRequest()); } _context.Entry(categories).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriesExists(id)) { return(NotFound()); } else { return(BadRequest()); } } return(categories); }
public ActionResult Edit([Bind(Include = "Id,UserName,Email,Password,PasswordCheck")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Department,Username,Email,Password,ConfirmPassword")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Update([Bind(Include = "Id,IsDone")] Task task) { if (ModelState.IsValid) { db.Tasks.Attach(task); db.Entry(task).Property(t => t.IsDone).IsModified = true; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); return(JsonSuccess(new { task = task })); } return(JsonError("Model is invalid")); }
public ActionResult Edit([Bind(Include = "Id,Description,DueDate,Completed,UserId")] Task task) { if (ModelState.IsValid) { db.Entry(task).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Users, "Id", "UserName", task.UserId); return(View(task)); }
public ActionResult Edit([Bind(Include = "Id,Title,Content,Severity,DeadLine,CreatedAt")] Task task) { if (ModelState.IsValid) { task.UpdatedAt = DateTime.Now; db.Entry(task).State = EntityState.Modified; db.SaveChanges(); TempData["flash"] = "タスクを編集しました。"; return(RedirectToAction("Index")); } return(View(task)); }
public void Update(PriorityType item) { db.Entry(item).State = EntityState.Modified; }
public void Update(TodoAndUsers item) { db.Entry(item).State = EntityState.Modified; }
/// <summary> /// Implementação do método que altera um registro. /// </summary> /// <param name="obj">Classe que esta sendo alterado o registro.</param> public void Update(TEntity obj) { _db.Entry(obj).State = EntityState.Modified; _db.SaveChanges(); }
public void Update(Projects item) { _context.Entry(item).State = EntityState.Modified; }
public void Update(TeamInfo item) { db.Entry(item).State = EntityState.Modified; }
public void Update(RolesType item) { db.Entry(item).State = EntityState.Modified; }
public void Update(Task task) { context.Entry(task).State = EntityState.Modified; context.SaveChanges(); }
public void Update(AttachmentType item) { db.Entry(item).State = EntityState.Modified; }
public virtual void Update(TEntity entity) { Db.Entry(entity).State = EntityState.Modified; Db.SaveChanges(); }
public void Update(User item) { db.Entry(item).State = EntityState.Modified; }