namespace VECV_WebApi.Controllers.Ticket { using ExcelHelper; #region Namespaces using LoggingHelper; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Mvc; using VECV_WebApi.Models.Customer; using VECV_WebApi.Models.EmailServices; using VECV_WebApi.Models.Ticket; using VECV_WebApi.Models.Vehicle; #endregion /// /// This controller contain ticket related api /// public class WhatupAPIController : ApiController { #region Global Variable /// /// making object of LoggingUtility class available to this class /// LoggingUtility objLog = new LoggingUtility(); /// /// making the data-log file path available to this class /// string path = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PathLog"]); /// /// making data log file path available to this class /// string logtf = (ConfigurationManager.AppSettings["Log"]); /// /// making error log file path available to this class /// string errorlogtf = (ConfigurationManager.AppSettings["ErrorLog"]); string _appName = (ConfigurationManager.AppSettings["ApplicationName"]); /// /// making the Database connection string available to this class /// private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString(); /// /// making Global Repository object available to this class /// /// GlobalRepository objGlobalRepository; /// /// making Customer Repository object available to this class /// CustomerRepository objCustomerRepository; /// /// making Ticket Repository object available to this class /// TicketRepository objTicketRepository; #endregion #region APIs public WhatupModel Post([FromBody] WhatupModel model) { // write data log into file WhatupModel objWhatupModel = new WhatupModel(); try { TicketRepository objTicket = new TicketRepository(_connStr); objWhatupModel = objTicket.SaveLocationDetailsWhatsup(model); return objWhatupModel; } catch (Exception Ex) { // write error log into file objLog.ErrorLogFile("GetCustomerDetails_Controller", Ex.Message, path, errorlogtf); objWhatupModel = new WhatupModel(); objWhatupModel.Status = 0; objWhatupModel.Message = "Not Saved"; return objWhatupModel; } } public string Post([FromUri] string sendSMS, [FromBody] WhatupAPIModel model) { // write data log into file string strresponse = ""; //WhatupAPIModel strresponse = new WhatupAPIModel(); try { TicketRepository objTicket = new TicketRepository(_connStr); strresponse = objTicket.sendWhatupMessage(model); return strresponse; } catch (Exception Ex) { // write error log into file objLog.ErrorLogFile("GetCustomerDetails_Controller", Ex.Message, path, errorlogtf); strresponse = "Failed"; return strresponse; } } public string Post([FromUri] string getlatlng, [FromUri] string sendSMS, [FromBody] WhatupAPIModel model) { // write data log into file string strresponse = ""; //WhatupAPIModel strresponse = new WhatupAPIModel(); try { TicketRepository objTicket = new TicketRepository(_connStr); strresponse = objTicket.GetDetailsWhatsup(model); return strresponse; } catch (Exception Ex) { // write error log into file objLog.ErrorLogFile("GetCustomerDetails_Controller", Ex.Message, path, errorlogtf); strresponse = "Failed"; return strresponse; } } #endregion } }