public IHttpActionResult PurchaseSession(PurchaseTraingSessionVM model) { StringBuilder traceLog = null; ServiceResponse <bool> objResponse = null; try { traceLog = new StringBuilder(); traceLog.AppendLine("Start: PurchaseTraingSession() Request Data:-TrainerId-" + model.TrainerId + ",UserCredID-" + model.UserCredId + ",NumberOfSession-" + model.NumberOfSession + ",Amount-" + model.Amount); objResponse = new ServiceResponse <bool>(); if (model.Amount <= 0) { objResponse.IsResultTrue = false; objResponse.ErrorMessage = Message.InvalidTrainingSessionAmount; } else if (model.NumberOfSession <= 0) { objResponse.IsResultTrue = false; objResponse.ErrorMessage = Message.InvalidNumberOfTrainingSession; } else { objResponse.jsonData = TrainingSessionApiBL.PurchaseSessionToUser(model); objResponse.IsResultTrue = true; } return(Ok(objResponse)); } catch (Exception ex) { LogManager.LogManagerInstance.WriteErrorLog(ex); return(BadRequest(ex.Message)); } finally { traceLog.AppendLine("End:PurchaseTraingSession() Response Result Status-" + objResponse.IsResultTrue + ",Posted DateTime-" + DateTime.Now.ToLongDateString()); LogManager.LogManagerInstance.WriteTraceLog(traceLog); traceLog = null; } }