예제 #1
0
 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;
 }
예제 #2
0
        public ActionResult Create(Team team)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    teamRepository.Create(team);
                    // Bootstrap Alert
                    return RedirectToAction("Index");
                }
                catch (Exception ex)
                {
                    // Handle
                }
            }

            return View(team);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public Team Create(Team entity)
 {
     var team = context.Teams.Add(entity);
     context.SaveChanges();
     return team;
 }
예제 #5
0
 public Team Update(Team entity)
 {
     session.SaveOrUpdate(entity);
     Team team = session.Get<Team>(entity.Id);
     return team;
 }
예제 #6
0
 public Team Create(Team entity)
 {
     var id = session.Save(entity);
     Team team = session.Get<Team>(id);
     return team;
 }