コード例 #1
0
        public void AddRequest(RequestModel model)
        {
            RequestService service = new RequestService();
            var UserProfilerModel = service.AddRequest(model);

            var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ToString());
            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            CloudQueue thumbnailRequestQueue = queueClient.GetQueueReference("addrequest");
            thumbnailRequestQueue.CreateIfNotExists();
            var queueMessage = new CloudQueueMessage(JsonConvert.SerializeObject(new NewRequest { RequestId = UserProfilerModel.Id }));
            thumbnailRequestQueue.AddMessage(queueMessage);
        }
コード例 #2
0
ファイル: RequestService.cs プロジェクト: travipl2015/Clique
        public RequestModel AddRequest(RequestModel model)
        {
            if (model.LocationId == 0)
            {
                var locationModel = AddLocation(new LocationModel { Pincode = model.Pincode, City = model.City });
                model.LocationId = locationModel.Id;
            }
            if (model.UserId == 0)
            {
                var userModel = AddUser(new UserModel
                {
                    MobileNo = model.MobileNo,
                    EmailId = model.EmailId,
                    Name = model.UserName,
                    TwitterUserName = model.TwitterUserName
                });

                model.UserId = userModel.Id;
            }
            var request = new CliqueRequest
            {
                Address = model.Address,
                BuildingName = model.BuildingName,
                CreatedAt = DateTime.Now,
                ModifiedAt = DateTime.Now,
                FromDate = model.FromDate,
                ToDate = model.ToDate,
                LocationId = model.LocationId,
                UserId = model.UserId

            };
            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                var response = entity.CliqueRequests.Add(request);
                entity.SaveChanges();
                model.Id = response.Id;

            }
            return model;
        }