Esempio n. 1
0
        public async Task <Object> retrieveMarriageHall(string sId, string pId)

        {
            var Property = Builders <Property> .Filter.Eq("propertyId", pId);

            var society = Builders <Property> .Filter.Eq("societyId", sId);

            var combineFilters = Builders <Property> .Filter.And(society, Property);

            Task <Property> itemsTask = Task.Run(() => (collection.Find(Property).FirstOrDefaultAsync()));

            if (itemsTask != null)
            {
                Property prop = itemsTask.Result;
                if (prop != null)
                {
                    if (prop.Commercial != null)
                    {
                        MarriageHall marriageHallData = prop.Commercial.marriageHall;
                        return(marriageHallData);
                    }
                }
                return("No property found");
            }
            return(null);
        }
Esempio n. 2
0
        public async Task <Object> updateMariageHallProfile(string sIdPId, [FromBody] MarriageHall MariageHall)
        {
            //      if(MariageHall != null){
            //         string []id=sIdPId.Split(",");
            //     if(id !=null && sIdPId.Contains(",")){
            //    Object flag = await context.updateMariageHall(id[0],id[1], MariageHall);

            //     return flag;
            //     }
            //     return "no comma detected";
            //      }
            //      return "MariageHall is null";
            return(JsonConvert.SerializeObject(MariageHall));
        }
        public async Task <Object> postMariageHallProfile(string sIdPId, [FromBody] MarriageHall marriageHall)
        {
            if (marriageHall != null)
            {
                string [] id = sIdPId.Split(",");
                if (id != null && sIdPId.Contains(","))
                {
                    Object flag = await context.updatemarriageHallMenue(id[0], id[1], marriageHall);

                    return(flag);
                }
                return("no comma detected");
            }
            return("Mariage Hall is null");
        }
        public async Task <Object> updateMariageHallProfile(string sIdPId, [FromBody] MarriageHall MariageHall)
        {
            if (MariageHall != null)
            {
                string [] id = sIdPId.Split(",");
                if (id != null && sIdPId.Contains(","))
                {
                    Object flag = await context.updatemarriageHallMenue(id[0], id[1], MariageHall);

                    return(flag);
                }
                return("no comma detected");
            }

            return(JsonConvert.SerializeObject(MariageHall));
        }
Esempio n. 5
0
        public async Task <Object> updatemarriageHallMenue(string sId, string pId, MarriageHall marriageHall)
        {
            try{
                var society = Builders <Property> .Filter.Eq("societyId", sId);

                var Property = Builders <Property> .Filter.Eq("propertyId", pId);

                var combineFilters = Builders <Property> .Filter.And(society, Property);

                Task <Property> itemsTask = Task.Run(() => (collection.Find(Property).FirstOrDefaultAsync()));
                //Property prop  = (Property)var;
                if (itemsTask != null)
                {
                    Property prop = itemsTask.Result;
                    if (prop.Commercial != null)
                    {
                        if (prop.Commercial.marriageHall != null)
                        {
                            prop.Commercial.marriageHall = marriageHall;
                            await collection.ReplaceOneAsync(ZZ => ZZ.propertyId == pId &&
                                                             ZZ.societyId == sId, prop);

                            return(true);
                        }
                        else
                        {
                            return(pId + " is not a marriage Hall");
                        }
                    }
                    else
                    {
                        return(pId + " is not a commercial property");
                    };
                }
            }catch (Exception ex) {
                return(ex.Message);
            }
            return(false);
        }