Exemple #1
0
        public ActionResult Update(int id)
        {
            CardDesign Design = db.CardDesigns.SqlQuery("Select * from CardDesigns where CardDesignId = @id", new SqlParameter("@id", id)).FirstOrDefault();

            Debug.WriteLine("I am trying to show card design id" + id);
            return(View(Design));
        }
 public void ApplyToCanvas(Canvas canvas, CardDesign design, Card card)
 {
     foreach (var component in design.CardComponents)
     {
         if (component is RectangleComponent rectComponent)
         {
             ApplyRectangle(canvas, rectComponent, card);
         }
     }
 }
        public ActionResult Delete(int id)
        {
            //find the card with that particular id
            GetWellSoonCard Card = db.GetWellSoonCards.Find(id);
            /*GetWellSoonCard Card = db.GetWellSoonCards.SqlQuery("Select * from GetWellSoonCards where CardId = @id", new SqlParameter("@id", id)).FirstOrDefault();*/
            //To do: Look into inner join Linq
            CardDesign Design = db.CardDesigns.SqlQuery("Select * from CardDesigns inner join GetWellSoonCards on GetWellSoonCards.CardDesignId = CardDesigns.CardDesignId where CardId = @id", new SqlParameter("@id", id)).FirstOrDefault();

            Debug.WriteLine("I am trying to show card id" + id);
            ShowGetWell ShowGetWellViewModel = new ShowGetWell();

            ShowGetWellViewModel.GetWellSoonCard = Card;
            ShowGetWellViewModel.CardDesign      = Design;
            return(View(ShowGetWellViewModel));
        }
        public ActionResult Show(int id)
        {
            //grab the id of current logged in user to display their names, phone etc...
            string          userId      = User.Identity.GetUserId();
            ApplicationUser currentUser = db.Users.FirstOrDefault(x => x.Id == userId);
            //display the cards and the design of cards
            GetWellSoonCard Card = db.GetWellSoonCards.Find(id);
            //GetWellSoonCard Card = db.GetWellSoonCards.SqlQuery("Select * from GetWellSoonCards where CardId = @id", new SqlParameter("@id", id)).FirstOrDefault();
            //Look into Inner join
            CardDesign Design = db.CardDesigns.SqlQuery("Select * from CardDesigns inner join GetWellSoonCards on GetWellSoonCards.CardDesignId = CardDesigns.CardDesignId where CardId = @id", new SqlParameter("@id", id)).FirstOrDefault();

            Debug.WriteLine("I am trying to show card id" + id);
            //instanciate the class
            ShowGetWell ShowGetWellViewModel = new ShowGetWell();

            ShowGetWellViewModel.GetWellSoonCard = Card;
            ShowGetWellViewModel.CardDesign      = Design;
            ShowGetWellViewModel.User            = currentUser;
            return(View(ShowGetWellViewModel));
        }