示例#1
0
 /// <summary>
 /// מקבלת כרטיס בעסק ובודקת האם קיים לעסק כזה כרטיס
 /// </summary>
 /// <param name="enterpCardDTO"></param>
 /// <returns></returns>
 public static bool isEnterpCardExist(EnterpCardsDTO enterpCardDTO)
 {
     using (ClubCardsEntities db = new ClubCardsEntities())
     {
         EnterpCards enterpCard = Conversion.EnterpCardsConversion.ConvertToEnterpCards(enterpCardDTO);
         if (db.EnterpCards.FirstOrDefault(x => x.EnterpId == enterpCard.EnterpId && x.Type == enterpCard.Type) != null)
         {
             return(true);
         }
         return(false);
     }
 }
        public static EnterpCards ConvertToEnterpCards(EnterpCardsDTO EnterpCardDTO)
        {
            EnterpCards newEnterpCard = new EnterpCards();

            newEnterpCard.C_id               = EnterpCardDTO.C_id;
            newEnterpCard.Cost               = EnterpCardDTO.Cost;
            newEnterpCard.EnterpId           = EnterpCardDTO.EnterpId;
            newEnterpCard.Type               = EnterpCardDTO.Type;
            newEnterpCard.Img                = EnterpCardDTO.Img;
            newEnterpCard.CountPoints        = EnterpCardDTO.CountPoints;
            newEnterpCard.PriseForBirthDayId = EnterpCardDTO.PriseForBirthDayId;
            newEnterpCard.PriseForNewId      = EnterpCardDTO.PriseForNewId;
            return(newEnterpCard);
        }
        public static EnterpCardsDTO ConvertToDTO(EnterpCards EnterpCard)
        {
            EnterpCardsDTO newEnterpCard = new EnterpCardsDTO();

            newEnterpCard.C_id               = EnterpCard.C_id;
            newEnterpCard.Cost               = EnterpCard.Cost;
            newEnterpCard.EnterpId           = EnterpCard.EnterpId;
            newEnterpCard.Type               = EnterpCard.Type;
            newEnterpCard.Img                = EnterpCard.Img;
            newEnterpCard.CountPoints        = EnterpCard.CountPoints;
            newEnterpCard.PriseForBirthDayId = EnterpCard.PriseForBirthDayId;
            newEnterpCard.PriseForNewId      = EnterpCard.PriseForNewId;
            return(newEnterpCard);
        }