public void CreateCard(string title, string estimate, string createdAt, string email)
        {
            var card = new Card
            {
                Id        = Guid.NewGuid(),
                Estimate  = Convert.ToUInt64(estimate),
                CreatedAt = Convert.ToUInt64(createdAt),
                Status    = TimeCardStatus.waiting,
                Title     = title,
                UserId    = Users.GetUserByEmail(email).Id,
            };

            Cards.AddCard(card);
        }
示例#2
0
        public IActionResult Post(string card)
        {
            var    status  = false;
            string message = ResultState.Add_FALSE;
            var    data    = JsonConvert.DeserializeObject <Card>(card);

            if (User.Identity.IsAuthenticated)
            {
                _CardRepository.AddCard(data);
                _CardRepository.SaveChange();
                status  = true;
                message = ResultState.Add_SUCCESS;
            }
            return(Json(new
            {
                message = message,
                status = status
            }));
        }
        public async Task <IActionResult> AddCard([FromBody] Card card, int projectId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var c        = User.Identity.Name;
            var identity = (ClaimsIdentity)User.Identity;
            IEnumerable <Claim> claims = identity.Claims;
            var userId = claims.FirstOrDefault();

            await _cardRepo.AddCard(card, Convert.ToInt32(userId.Value), projectId);

            if (await _cardRepo.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Fail to add card!");
        }
示例#4
0
        public bool Action()
        {
            if (com != null)
            {
                DataBase.Entities.Com portCom =
                    new DataBase.Entities.Com {
                    ComName = com.Name, Description = com.Description
                };
                db.AddCom(portCom);
                if (card != null)
                {
                    DataBase.Entities.SimCard simCard = new DataBase.Entities.SimCard {
                        ComName = com.Name, Operator = card.Operator.ToString(), Number = card.Number
                    };
                    db.AddCard(simCard);
                    Console.WriteLine("Данные сохранены в БД");
                    Console.WriteLine($"com.Name: {com.Name}\r\ncom.Description: {com.Description}\r\ncard.Number: {card.Number}\r\ncard.Operator: {card.Operator}");
                }
            }

            return(true);
        }
示例#5
0
        public async Task <TokenInfo> RegisterCard(CardInfo cardInfo)
        {
            CardData cardData = new CardData
            {
                CardNumber       = cardInfo.CardNumber,
                CVV              = cardInfo.CVV,
                RegistrationData = DateTime.UtcNow
            };

            _cardRepository.AddCard(cardData);

            var token = await _tokenService.GenerateToken(cardData);

            var tokenInfo = new TokenInfo

            {
                Token            = token,
                RegistrationDate = cardData.RegistrationData
            };

            return(tokenInfo);
        }
        public Card PostAddCard(Card card)
        {
            Card model = repository.AddCard(card);

            return(model);
        }
示例#7
0
 public int AddCard(SerCard card)
 {
     return(_repository.AddCard(new Card(card)));
 }