public static Merchant ConvertMerchantDTO(MerchantDTO merchant) { return(new Merchant() { Name = merchant.Name, URL = merchant.URL, Description = merchant.Description }); }
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); }
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); }
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); }