public ReturnValues SaveTicketDetails(TicketRequestModel ctReqest, string Reference) { var returnValues = new ReturnValues(); var counter = repotk_BatchCounter.GetAllNonAsync().FirstOrDefault(); try { var eventCust = new tk_EventCustomers(); eventCust.DateCreated = DateTime.UtcNow; eventCust.Email = ctReqest.email; eventCust.EventId = ctReqest.TicketType; eventCust.NoOfPersons = ctReqest.NoOfPersons; eventCust.PhoneNo = ctReqest.phoneNo; eventCust.ReferenceNo = Reference; eventCust.TicketCategory = Convert.ToInt32(ctReqest.TicketCategory); eventCust.Status = "PENDING"; eventCust.IsEmailSent = "N"; eventCust.Retry = 0; eventCust.Fullname = ctReqest.Fullname; eventCust.UnitPrice = repoEventCategory.GetNonAsync(o => o.Itbid == eventCust.TicketCategory).Amount; eventCust.TotalAmount = eventCust.UnitPrice * eventCust.NoOfPersons; eventCust.referalId = ctReqest.ReferalId == null ? null : ctReqest.ReferalId.ToString(); //eventCust.Validated = ctReqest.Validated; repoEventCustomer.Add(eventCust); var retV1 = unitOfWork.CommitNonAsync(1) > 0 ? true : false; if (retV1) { //Update batch Counter counter.BatchNo = counter.BatchNo + 1; repotk_BatchCounter.Update(counter); var ret = unitOfWork.CommitNonAsync(1) > 0 ? true : false; returnValues.nErrorCode = 0; returnValues.sErrorText = "Success"; return(returnValues); } else { returnValues.nErrorCode = -1; returnValues.sErrorText = "FailedInsert"; } return(returnValues); } catch (Exception ex) { } return(returnValues); }