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