public IHttpActionResult CreateBet([FromBody] CreateBetInsertReq model) { model.UserId = User.Identity.GetUserId(); var result = _transactionServices.Create(model); // notify all connected clients //if(result.Data) // Hub.Clients.All.newBet(model); return(ApiHelper.ReturnHttpAction(result, this)); }
public async Task <IActionResult> Create([Bind("Market,Coin,Unit,BuyingPrice,IsSold,SellPrice")] Transaction transaction) { if (ModelState.IsValid) { transaction.Id = Guid.NewGuid(); transaction.UserId = User.GetLoggedInUserId <Guid>(); transaction.CreatedBy = transaction.UserId.ToString(); transaction.CreateDt = DateTime.Now; transaction.Status = (short)Enums.EntityStatus.Active; await _transactionServices.Create(transaction); return(Redirect("/transactions")); } return(View(transaction)); }
public async Task <ApiResultModel <Transaction> > Create([FromBody] Transaction transaction, Guid userId) { try { if (ModelState.IsValid) { transaction.Id = Guid.NewGuid(); transaction.UserId = userId; transaction.CreatedBy = transaction.UserId.ToString(); transaction.CreateDt = DateTime.Now; transaction.Status = (short)Enums.EntityStatus.Active; await _transactionServices.Create(transaction); return(new ApiResultModel <Transaction>() { Data = transaction, Success = true, Message = "Success", Code = 200 }); } return(new ApiResultModel <Transaction>() { Data = transaction, Success = false, Message = JsonConvert.SerializeObject(ModelState.Values), Code = 500 }); } catch (Exception ex) { return(new ApiResultModel <Transaction>() { Data = new Transaction(), Success = false, Message = ex.Message, Code = ex.HResult }); } }
public IActionResult Post(TransactionVM transactionVM) { return(Ok(_transactionServices.Create(transactionVM))); }