Ejemplo n.º 1
0
        async Task <bool> IProjectFromLocalDB.DeleteProjectFromDB(int?Id)
        {
            Project project = await _db.Projects.FindAsync(Id);

            if (project != null)
            {
                _db.Projects.Remove(project);
                _db.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        async Task <bool> IPeopleFromLocalDB.DeletePeopleFromDB(int?Id)
        {
            People people = await _db.Peoples.FindAsync(Id);

            if (people != null)
            {
                if ("avatar.png" != people.FotoName)
                {
                    System.IO.File.Delete(HttpContext.Current.Server.MapPath("~/Fotos/" + people.FotoName));
                }
                _db.Peoples.Remove(people);
                _db.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 public ActionResult AddPeopleInProject(int?People_ID)
 {
     if (ProjectID != 0)
     {
         Project project = db.Projects.Find(ProjectID);
         People  people  = db.Peoples.Find(People_ID);
         people.Projects.Add(project);
         db.SaveChanges();
         return(RedirectToAction("DataBase"));
     }
     else
     {
         return(RedirectToAction("DataBase"));
     }
 }