Пример #1
0
        public int MakePost(NewPostWebModel model)
        {
            int myAthleteID = new UserProfileLogic(db).GetAthleteIDForUserName(User.Identity.Name);

            if (model.MetroID > 0)
            {
                return(new FeedLogic(db).MakePost(myAthleteID, model.MetroID, model.Text));
            }
            else
            {
                var country = Awpbs.Country.Get(model.Country);
                return(new FeedLogic(db).MakePost(myAthleteID, country, model.Text));
            }
        }
Пример #2
0
        public async Task <int?> MakePost(string country, int metroID, string text)
        {
            string url = WebApiUrl + "Newsfeed/MakePost";

            try
            {
                NewPostWebModel model = new NewPostWebModel()
                {
                    Country = country,
                    MetroID = metroID,
                    Text    = text
                };
                string json = await this.sendPostRequestAndReceiveResponse(url, model, true);

                int modelResponse = JsonConvert.DeserializeObject <int>(json);
                return(modelResponse);
            }
            catch (Exception exc)
            {
                LastExceptionUrl = url;
                LastException    = exc;
                return(null);
            }
        }