示例#1
0
        public bool DeletePhoto(int idfoto)
        {
            bool ok = true;

            try
            {
                using (var entities = new modelEntities())
                {
                    Foto foto = (from l in entities.Foto
                                 where l.Id == idfoto
                                 select l).FirstOrDefault();
                    string pathfoto = foto.Path;
                    entities.DeleteObject(foto);
                    entities.SaveChanges();
                    File.Delete(pathfoto);
                    return(ok);
                }
            }
            catch (Exception e)
            {
                string errore = e.ToString();
                ok = false;
                return(ok);
            }
        }
示例#2
0
        public bool DeleteImmobile(string codice)
        {
            bool ok = true;

            try
            {
                using (var entities = new modelEntities())
                {
                    Immobili imm = (from l in entities.Immobili
                                    where l.Codice == codice
                                    select l).FirstOrDefault();
                    entities.DeleteObject(imm);
                    entities.SaveChanges();
                    return(ok);
                }
            }
            catch (Exception e)
            {
                string errore = e.ToString();
                ok = false;
                return(ok);
            }
        }
示例#3
0
        public bool DeleteCollaborazioni(int id)
        {
            bool ok = true;

            try
            {
                using (var entities = new modelEntities())
                {
                    Collaborazioni imm = (from l in entities.Collaborazioni
                                          where l.Id == id
                                          select l).FirstOrDefault();
                    entities.DeleteObject(imm);
                    entities.SaveChanges();
                    return(ok);
                }
            }
            catch (Exception e)
            {
                string errore = e.ToString();
                ok = false;
                return(ok);
            }
        }