Ejemplo n.º 1
0
        ////////////////////////////////
        // updating home page content
        ////////////////////////////////
        public async Task <Boolean> updateHomeVal(BHome bHome, string bToChange)
        {
            if (bHome != null)
            {
                // int flag = 0;
                // the filter
                var builderF = Builders <Business> .Filter;
                var filter   = builderF.Eq("BName", bToChange);
                // the business to update
                var builderU = Builders <Business> .Update;
                UpdateDefinition <Business> update = builderU.Set("BHome", bHome);

                // the query
                UpdateResult result = await _businesses.UpdateOneAsync(filter, update);

                if (result.MatchedCount == result.ModifiedCount)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 // contructors of business
 public Business(string id        = "", string email      = "", string name = "", bool appointment = false,
                 bool gallery     = false, string[] owner = null, string[] client = null,
                 string[] blocked = null, BHome home      = null, BAbout about    = null, bool connected = false)
 {
     Id           = id;
     bMail        = email;
     bName        = name;
     bAppointment = appointment;
     bGallery     = gallery;
     if (owner == null)
     {
         owner = new string[1];
     }
     bOwner = owner;
     if (client == null)
     {
         client = new string[1];
     }
     bClient = client;
     if (blocked == null)
     {
         blocked = new string[1];
     }
     bBlockedList = blocked;
     if (home == null)
     {
         home = new BHome();
     }
     if (about == null)
     {
         about = new BAbout();
     }
     bHome          = home;
     bAbout         = about;
     ownerConnected = connected;
 }