示例#1
0
        public string SaveRecords(JObject container)
        {
            if (container != null)
            {
                try
                {
                    SaveRecordsModel Projecto = container.ToObject <SaveRecordsModel>();
                    if (Projecto != null)
                    {
                        if (Projecto.ArrAloj != null)
                        {
                            foreach (var item in Projecto.ArrAloj)
                            {
                                Alojamento.Insert(item);
                            }
                        }
                        if (Projecto.ArrVoos != null)
                        {
                            foreach (var item in Projecto.ArrVoos)
                            {
                                Voos.Insert(item);
                            }
                        }
                        if (Projecto.ArrDiarias != null)
                        {
                            foreach (var item in Projecto.ArrDiarias)
                            {
                                Diarias.Insert(item);
                            }
                        }
                        if (Projecto.ArrServicos != null)
                        {
                            foreach (var item in Projecto.ArrServicos)
                            {
                                ServicoTT.Insert(item);
                            }
                        }
                    }

                    return("Ok");
                }
                catch (Exception ex)
                {
                    return(ex.InnerException.ToString());
                }
            }
            else
            {
                return("no_magic");
            }
        }
示例#2
0
        public string InsertAlojamento(JObject Obj)
        {
            var id        = Obj.GetValue("hotel").ToString();
            var Orcamento = Obj.GetValue("Objeto");

            Alojamento aloj = Orcamento.ToObject <Alojamento>();

            if (id == "")
            {
                Alojamento.Insert(aloj);
            }
            else
            {
                ObjectId pantObj = new ObjectId(id);
                aloj.Id = pantObj;
                Alojamento.Update(aloj);
            }

            return("");
        }