public string LinkedInScheduleUpdate(LinkedInManager LinkedInManager) { string json = ""; if (LinkedInManager.ScheduleTime <= DateTime.Now) { oAuthLinkedIn _oauth = new oAuthLinkedIn(); Domain.Socioboard.Domain.LinkedInAccount _LinkedinAccount = objLinkedInAccountRepository.getLinkedinAccountDetailsById(LinkedInManager.ProfileId); try { _oauth.ConsumerKey = ConfigurationManager.AppSettings["LinkedinApiKey"]; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } try { _oauth.ConsumerSecret = ConfigurationManager.AppSettings["LinkedinSecretKey"]; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } _oauth.Token = _LinkedinAccount.OAuthToken; string PostUrl = "https://api.linkedin.com/v1/people/~/shares?format=json"; if (string.IsNullOrEmpty(LinkedInManager.ImageUrl)) { json = _oauth.LinkedProfilePostWebRequest("POST", PostUrl, LinkedInManager.comment); } else { string imagepath = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(LinkedInManager.ImageUrl, "wwwroot")[1].Replace("\\", "/"); json = _oauth.LinkedProfilePostWebRequestWithImage("POST", PostUrl, LinkedInManager.comment, imagepath); } if (!string.IsNullOrEmpty(json)) { json = "Message post on LinkedIn for Id :" + LinkedInManager.ProfileId + " and Message: " + LinkedInManager.comment; objScheduledMessageRepository.UpdateScheduledMessage(Guid.Parse(LinkedInManager.ScheduleMessageId)); } else { json = "Something Went Wrong"; } } return(json); }
public void UpdateScheduledMessageByMsgId(Guid msgId) { ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); objScheduledMessageRepository.UpdateScheduledMessage(msgId); }