public int AddTeam(string nIdentifier, string nTitle, string nDescription, int nManagerID, int nCreatedByID, int nModifiedByID, string nCreatedByName, string nManagerName)
        {
            var newTeam = new Team
            {
                Identifier = nIdentifier,
                Title = nTitle,
                Description = nDescription,
                ManagerID = nManagerID,
                CreatedByID = nCreatedByID,
                CreatedOn = DateTime.Now,
                ModifiedByID = nModifiedByID,
                ModifiedOn = DateTime.Now,
                CreatedByName = nCreatedByName,
                ManagerName = nManagerName
            };

            context.Teams.Add(newTeam);
            var result = context.SaveChanges();
            return result;
        }
        public ActionResult Edit(Team team)
        {
            if (ModelState.IsValid)
            {

                var cookie = Request.Cookies[FormsAuthentication.FormsCookieName];
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);
                var username = ticket.Name;
                var user = repository.Users.SingleOrDefault(u => u.userName == username);
                int userid = user.id;

                team.ModifiedByID = userid;
                team.ModifiedOn = DateTime.Now;
                var result = repository.EditTeam(team);
                if (result > 0)
                    TempData["message"] = string.Format("Team {0} has been saved.", team.Identifier);
                else
                    TempData["message"] = string.Format("Unsuccessful procedure!");
            }
            return RedirectToAction("TeamList", "TeamManagement");
        }
 public int EditTeam(Team team)
 {
     context.Entry(team).State = System.Data.EntityState.Modified;
     var result = context.SaveChanges();
     return result;
 }