//public async Task<TranStatus> Refresh_Sales_Location(Refresh_Sales_Location_Model model) //{ // using (salesRepository = new SalesRepository()) // { // return await salesRepository.Refresh_Sales_Location(model); // } //} public Task <TranStatus> Refresh_Sales_Location(Refresh_Sales_Location_Model model) { using (salesRepository = new SalesRepository()) { return(salesRepository.Refresh_Sales_Location(model)); } }
public async Task <IActionResult> Refresh_Sales_Location([FromBody] Refresh_Sales_Location_Model model) { Dictionary <String, Object> dctData = new Dictionary <string, object>(); HttpStatusCode statusCode = HttpStatusCode.OK; TranStatus transaction = new TranStatus(); try { transaction = await isales.Refresh_Sales_Location(model); } catch (Exception ex) { transaction = CommonHelper.TransactionErrorHandler(ex); statusCode = HttpStatusCode.BadRequest; } dctData.Add("Status", transaction); return(this.StatusCode(Convert.ToInt32(statusCode), dctData)); }
public async Task <TranStatus> Refresh_Sales_Location(Refresh_Sales_Location_Model model) { using (var connection = new SqlConnection(ConnectionString)) { await connection.OpenAsync(); TranStatus transaction = new TranStatus(); DynamicParameters parameter = new DynamicParameters(); parameter.Add("@Sales_ID", model.UserId); parameter.Add("@Latitude", model.Latitude); parameter.Add("@Longitude", model.Longitude); parameter.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 500); parameter.Add("@Code", dbType: DbType.Int32, direction: ParameterDirection.Output); await connection.QueryAsync("Refresh_Sales_Location", parameter, commandType : CommandType.StoredProcedure); transaction.returnMessage = parameter.Get <string>("@Message"); transaction.code = parameter.Get <int>("@Code"); return(transaction); } }