Пример #1
0
        public void Delete(Project project)
        {
            var projectToRemove = Projects.FirstOrDefault(p => p.id == project.id);

            if (projectToRemove != null)
            {
                Projects.Remove(projectToRemove);
            }
        }
Пример #2
0
 public void Save(Project project)
 {
     if (project.id <= 0)
     {
         project.id = Projects.Any() ? Projects.Max(p => p.id) + 1 : 1;
     }
     if (Projects.Any() && Projects.Any(p => p.id == project.id))
     {
         Projects.First(p => p.id == project.id).projectName = project.projectName;
     }
     else
     {
         Projects.Add(project);
     }
 }
Пример #3
0
 public ActionResult Update(Project project)
 {
     projectRepository.Save(project);
     return Json(project);
 }