public Guid CreateOrder(Guid userId, string type) { int amount = 0; switch (type) { case "silver": amount = Convert.ToInt32(_systemParameterRepository.GetByParameterName("S").ParameterValue); break; case "gold": amount = Convert.ToInt32(_systemParameterRepository.GetByParameterName("G").ParameterValue); break; case "platinum": amount = Convert.ToInt32(_systemParameterRepository.GetByParameterName("P").ParameterValue); break; } var price = amount * Convert.ToInt32(_systemParameterRepository.GetByParameterName("T").ParameterValue); var orderId = Guid.NewGuid(); var timestamp = DateTime.Now; TokenOrder order = new TokenOrder { Id = orderId, Amount = amount, Price = price, UserId = userId, StatusId = _tokenOrderStatusRepository.GetByType("SUBMITTED").Id, TimestampCreated = timestamp, TimestampChanged = timestamp }; _tokenOrderRepository.Save(order); return(orderId); }