Esempio n. 1
0
        //--------------------------------------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------------------------------------
        //_________________________________   User Mangagement   ____________________________________________________________________
        // check if the user alleready exist

        public bool addNewInterior(classInterior i)
        {
            var newInterior = new InteriorTable
            {
                Name        = i.name,
                Description = i.Description,
                DesignerID  = 1,
                RoomType    = i.roomType,
                Image       = i.imge,
                TotalPrice  = i.total,
                Available   = 1,
                Date        = DateTime.Now,
                FurnitureID = 1,
                DesignType  = i.cateory
            };

            db.InteriorTables.InsertOnSubmit(newInterior);
            try
            {
                db.SubmitChanges();
                return(true);
            }catch (Exception ex)
            {
                ex.GetBaseException();
                return(false);
            }
        }
Esempio n. 2
0
 // Getting Interior from the dataBase
 public classInterior getInterior(string cat)
 {
     if (cat == "")
     {
         var           interior = (from i in db.InteriorTables orderby i.Date ascending select i).FirstOrDefault();
         classInterior geted    = new classInterior
         {
             name        = interior.Name,
             Description = interior.Description,
             imge        = interior.Image
         };
         return(geted);
     }
     else
     {
         var           interior = (from i in db.InteriorTables where i.DesignType.Equals(cat) orderby i.Date ascending select i).FirstOrDefault();
         classInterior geted    = new classInterior
         {
             name        = interior.Name,
             Description = interior.Description,
             imge        = interior.Image
         };
         return(geted);
     }
 }