public CustomShareText Edit(CustomShareText shareText) { try { connection.Open(); var cmd = connection.CreateCommand() as SqlCommand; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "CustomShareText_Edit"; cmd.Parameters.Add(new SqlParameter("@RegionId", shareText.RegionId)); cmd.Parameters.Add(new SqlParameter("@Language", shareText.Language)); cmd.Parameters.Add(new SqlParameter("@ShareOk", shareText.ShareOk)); cmd.Parameters.Add(new SqlParameter("@ShareAlert", shareText.ShareAlert)); cmd.Parameters.Add(new SqlParameter("@ShareAlertFinca", shareText.ShareAlertFinca)); cmd.Parameters.Add(new SqlParameter("@HashTagRegister", shareText.HashTagRegister)); cmd.Parameters.Add(new SqlParameter("@HashTagReportConfirmed", shareText.HashTagReportConfirmed)); cmd.Parameters.Add(new SqlParameter("@HashTagRanking", shareText.HashTagRanking)); cmd.Parameters.Add(new SqlParameter("@HashTagTop1", shareText.HashTagTop1)); cmd.Parameters.Add(new SqlParameter("@HashTagCheck", shareText.HashTagCheck)); cmd.Parameters.Add(new SqlParameter("@HashTagVerification", shareText.HashTagVerification)); cmd.Parameters.Add(new SqlParameter("@HashTagDenounce", shareText.HashTagDenounce)); cmd.Parameters.Add(new SqlParameter("@HashTagContestWon", shareText.HashTagContestWon)); cmd.Parameters.Add(new SqlParameter("@Id", shareText.Id)); cmd.ExecuteNonQuery(); connection.Close(); return(null); } catch (Exception ex) { throw ex; } }
public CustomShareText GetByRegionIdAndLanguage(int regionId, string language) { connection.Open(); var cmd = connection.CreateCommand() as SqlCommand; cmd.CommandType = CommandType.StoredProcedure; CustomShareText shareTexts = connection.Query <CustomShareText>(string.Format("EXEC CustomShareText_GetByRegionAndLanguage {0}, '{1}'", regionId, language)).FirstOrDefault(); connection.Close(); return(shareTexts); }
public CustomShareText GetById(int id) { connection.Open(); var cmd = connection.CreateCommand() as SqlCommand; cmd.CommandType = CommandType.StoredProcedure; CustomShareText shareText = connection.Query <CustomShareText>(string.Format("EXEC CustomShareText_GetById {0}", id)).FirstOrDefault(); connection.Close(); return(shareText); }
public HttpResponseMessage <CustomShareText> Edit(CustomShareText shareText, HttpRequestMessage <CustomShareText> request) { if (shareText != null) { var shareTextDb = customShareTextRepository.Edit(shareText); return(new HttpResponseMessage <CustomShareText>(shareTextDb) { StatusCode = HttpStatusCode.Created }); } return(new HttpResponseMessage <CustomShareText>(null) { StatusCode = HttpStatusCode.NotFound, }); }
public HttpResponseMessage <CustomShareText> Post(CustomShareText shareText, HttpRequestMessage <CustomShareText> request) { if (shareText != null) { var shareTextDB = customShareTextRepository.Insert(shareText); var response = new HttpResponseMessage <CustomShareText>(shareTextDB) { StatusCode = HttpStatusCode.Created }; return(response); } return(new HttpResponseMessage <CustomShareText>(null) { StatusCode = HttpStatusCode.NotFound, }); }
public HttpResponseMessage <CustomShareText> GetByRegionIdAndLanguage(CustomShareText shareText, HttpRequestMessage <CustomShareText> request) { try { return(new HttpResponseMessage <CustomShareText>(customShareTextRepository.GetByRegionIdAndLanguage(shareText.RegionId, shareText.Language)) { StatusCode = HttpStatusCode.OK }); } catch { return(new HttpResponseMessage <CustomShareText>(null) { StatusCode = HttpStatusCode.BadRequest }); } }
public void GetByRegionIdAndLanguage(int regionId, string language) { client.Authenticator = new HttpBasicAuthenticator(Current.Instance.Username, Current.Instance.Password); var request = new RestRequest("customsharetext/getbyregionidandlanguage", Method.POST) { RequestFormat = DataFormat.Json }; request.JsonSerializer = new JsonSerializer(); var shareText = new CustomShareText(); shareText.RegionId = regionId; shareText.Language = language; request.AddBody(shareText); client.ExecuteAsync <CustomShareText>(request, response => Deployment.Current.Dispatcher.BeginInvoke(() => TextsReceived(response.Data, null) )); }