public Team Update(Team entity) { Team team = context.Teams.Find(entity.Id); context.Entry(team).CurrentValues.SetValues(entity); context.Entry(team).State = EntityState.Modified; context.SaveChanges(); return team; }
public ActionResult Create(Team team) { if (ModelState.IsValid) { try { teamRepository.Create(team); // Bootstrap Alert return RedirectToAction("Index"); } catch (Exception ex) { // Handle } } return View(team); }
public ActionResult Edit(Team team) { if (ModelState.IsValid) { try { teamRepository.Update(team); // Bootstrap Alert return RedirectToAction("Index"); } catch (Exception e) { // Handle } } ViewBag.Employees = new MultiSelectList(employeeRepository.GetAll(), "Id", "Email", team.Employees.Select(employee => employee.Id)); return View(team); }
public Team Create(Team entity) { var team = context.Teams.Add(entity); context.SaveChanges(); return team; }
public Team Update(Team entity) { session.SaveOrUpdate(entity); Team team = session.Get<Team>(entity.Id); return team; }
public Team Create(Team entity) { var id = session.Save(entity); Team team = session.Get<Team>(id); return team; }