Пример #1
0
 public virtual void AddCard(Cards cards)
 {
     if (!_cards.Contains(cards))
     {
         _cards.Add(cards);
     }
 }
Пример #2
0
        public ReturnModel GetOrganizations(long lineId, string accessToken)
        {
            var account = _readOnlyRepository.First<Account>(account1 => account1.Token == accessToken);
            ReturnModel remodel = new ReturnModel();
            if (account != null)
            {
                if (account.VerifyToken(account))
                {
                    var line = _readOnlyRepository.GetById<Lanes>(lineId);
                    if (line != null)
                    {
                        ReturnCardsModel cardsModel = _mappingEngine.Map<Lanes, ReturnCardsModel>(line);
                        var cards = new ReturnCardsModel();
                        cards.Cards = new List<Cards>();
                        foreach (var or in cardsModel.Cards)
                        {
                            if (!or.IsArchived)
                            {
                                var o = new Cards();
                                o.Text = or.Text;
                                o.Id = or.Id;
                                cards.Cards.Add(o);
                            }

                        }
                        return cards.ConfigureModel("Successfull", "", cards);
                    }
                }
                return remodel.ConfigureModel("Error", "Su session ya expiro", remodel);
            }
            return remodel.ConfigureModel("Error", "No se pudo acceder a su cuenta", remodel);
        }
Пример #3
0
        public ReturnModel MoveCardToLane([FromBody] MoveCardModel model, string accessToken)
        {
            var account = _readOnlyRepository.First<Account>(account1 => account1.Token == accessToken);
            ReturnModel remodel=new ReturnModel();
            if (account != null)
            {
                if (account.VerifyToken(account))
                {
                    var card = _readOnlyRepository.GetById<Cards>(model.Id);
                    Cards card1 =new Cards();
                    card1.Text=card.Text;
                    card1.Description = card.Description;
                    var line = _readOnlyRepository.GetById<Lanes>(model.IdLineTo);

                    line.AddCard(card1);
                    var archivedCard = _writeOnlyRepository.Archive(card);
                    var updateLine = _writeOnlyRepository.Update(line);
                    Activity activity = new Activity();
                    activity.Text = account.FirstName + " Movio la card "+card.Text+" a la line: "+line.Title;
                    account.AddActivities(activity);
                    var accountUpdate = _writeOnlyRepository.Update(account);
                    return remodel.ConfigureModel("Successfull", "Se movio correctamente la card", remodel);
                }
                return remodel.ConfigureModel("Error", "Su session ya expiro", remodel);
            }
            return remodel.ConfigureModel("Error", "No se pudo acceder a su cuenta", remodel);
        }