Ejemplo n.º 1
0
 public static Merchant ConvertMerchantDTO(MerchantDTO merchant)
 {
     return(new Merchant()
     {
         Name = merchant.Name,
         URL = merchant.URL,
         Description = merchant.Description
     });
 }
Ejemplo n.º 2
0
        public bool SaveMerchant(MerchantDTO merchant)
        {
            int    result = 0;
            string sql    = "INSERT INTO [Merchant] " +
                            "([Name],[URL],[Description]) " +
                            "VALUES ('{0}','{1}','{2}')";

            result = dataContext.ExecuteCommand(string.Format(sql, merchant.Name, merchant.URL, merchant.Description));
            return(result > 0);
        }
Ejemplo n.º 3
0
        public bool UpdateMerchant(int id, MerchantDTO _merchant)
        {
            int    result = 0;
            string sql    = "UPDATE [Merchant] " +
                            "SET [Name] = '{0}' " +
                            ",[URL] = '{1}' " +
                            ",[Description] = '{2}' " +
                            "WHERE [MerchantID] = {3} ";

            result = dataContext.ExecuteCommand(string.Format(sql, _merchant.Name, _merchant.URL, _merchant.Description, id));
            return(result > 0);
        }
Ejemplo n.º 4
0
        public MerchantDTO GetOne(int id)
        {
            MerchantDTO m = null;

            var result = dataContext.Merchants.Where(x => x.MerchantID == id).FirstOrDefault();

            if (result != null)
            {
                m = DTOConverter.ConvertMerchant(result);
            }
            return(m);
        }