本文整理汇总了C#中Models.Product类的典型用法代码示例。如果您正苦于以下问题:C# Product类的具体用法?C# Product怎么用?C# Product使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Product类属于Models命名空间,在下文中一共展示了Product类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BeginPutNonRetry400Async
/// <summary>
/// Long running put request, service returns a 400 to the initial request
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='product'>
/// Product to put
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Product> BeginPutNonRetry400Async(this ILROSADsOperations operations, Product product = default(Product), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.BeginPutNonRetry400WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:19,代码来源:LROSADsOperationsExtensions.cs
示例2: DeepCopyProduct
/// <summary>
/// Makes deep copy of Product.
/// Entity Framework cannot keep track of 1 item in 2 contexts, so in order to
/// export something and import it in other database it needs deep copy of it.
/// </summary>
/// <param name="product">Product for copy.</param>
/// <param name="vendor">Product's vendor.</param>
/// <returns>Deep copy of the product</returns>
private static Product DeepCopyProduct(Product product, Vendor vendor)
{
var incomes = product.Incomes
.Select(income => new Income()
{
Quantity = income.Quantity,
SalePrice = income.SalePrice
})
.ToList();
var expenses = product.Vendor.Expenses
.Select(expense => new Expense()
{
Amount = expense.Amount,
})
.ToList();
foreach (var expense in expenses)
{
vendor.Expenses.Add(expense);
}
var deepCopyProduct = new Product()
{
Name = product.Name,
BuyingPrice = product.BuyingPrice,
Incomes = incomes,
Vendor = vendor
};
return deepCopyProduct;
}
开发者ID:Team-Sunflower-Sunbright,项目名称:DatabaseApps-Teamwork,代码行数:40,代码来源:MySqlImporter.cs
示例3: Put200SucceededAsync
/// <summary>
/// Long running put request, service returns a 200 to the initial request,
/// with an entity that contains ProvisioningState=’Succeeded’.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='product'>
/// Product to put
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Product> Put200SucceededAsync(this ILROsOperations operations, Product product = default(Product), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.Put200SucceededWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:20,代码来源:LROsOperationsExtensions.cs
示例4: GetProductAsync
/// <summary>
/// Product Types
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='responseCode'>
/// The desired returned status code
/// </param>
/// <param name='product'>
/// The only parameter
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Product> GetProductAsync(this ISwaggerDataTypesClient operations, string responseCode = default(string), Product product = default(Product), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetProductWithHttpMessagesAsync(responseCode, product, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:22,代码来源:SwaggerDataTypesClientExtensions.cs
示例5: PostAsync
/// <summary>
/// Products
/// </summary>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='subscriptionId'>
/// Subscription Id.
/// </param>
/// <param name='resourceGroupName'>
/// Resource Group Id.
/// </param>
/// <param name='apiVersion'>
/// API Id.
/// </param>
/// <param name='body'>
/// API body mody.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Product> PostAsync( this IRecursiveTypesAPI operations, string subscriptionId, string resourceGroupName, string apiVersion, Product body = default(Product), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.PostWithHttpMessagesAsync(subscriptionId, resourceGroupName, apiVersion, body, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
开发者ID:ahirmayur,项目名称:autorest,代码行数:32,代码来源:RecursiveTypesAPIExtensions.cs
示例6: Put201CreatingSucceeded200Async
/// <summary>
/// Long running put request, service returns a 500, then a 201 to the initial
/// request, with an entity that contains ProvisioningState=’Creating’.
/// Polls return this value until the last poll returns a ‘200’ with
/// ProvisioningState=’Succeeded’
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='product'>
/// Product to put
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async System.Threading.Tasks.Task<Product> Put201CreatingSucceeded200Async(this ILRORetrysOperations operations, Product product = default(Product), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
using (var _result = await operations.Put201CreatingSucceeded200WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
开发者ID:DeepakRajendranMsft,项目名称:autorest,代码行数:22,代码来源:LRORetrysOperationsExtensions.cs
示例7: Delete
public void Delete(Product product)
{
var products = db.GetCollection<Product>("Products");
var query = Query.And(Query.EQ("Price", product.Price), Query.EQ("Name", product.Name));
var findAndRemoveArguments = new FindAndRemoveArgs();
findAndRemoveArguments.Query = query;
products.FindAndRemove(findAndRemoveArguments);
}
开发者ID:TelerikAcademyTeamTitanium,项目名称:DatabaseProject,代码行数:8,代码来源:DefaultProductsDAO.cs
示例8: insert_Click
private void insert_Click(object sender, EventArgs e)
{
Product product = new Product
{
Id = Int32.Parse(insertId.Text),
Name = insertName.Text,
Price = Double.Parse(insertPrice.Text),
Quantity = Int32.Parse(insertQuantity.Text)
};
DbAccessor accessor = DbAccessor.Instance;
accessor.CreateProduct(product);
}
开发者ID:shawn-l,项目名称:SalesSystem,代码行数:12,代码来源:ProductForm.cs
示例9: Edit
public ActionResult Edit(Product model, int id)
{
if (ModelState.IsValid)
{
_models.Remove(_models.Get(id));
model.Id = id;
_models.Add(model);
Success("The model was updated!");
return RedirectToAction("index");
}
return View("Create", model);
}
开发者ID:erangeljr,项目名称:newrelic-dot-net-kata,代码行数:12,代码来源:ProductController.cs
示例10: Create
public ActionResult Create(Product model)
{
if (ModelState.IsValid)
{
model.Id = _models.Count == 0 ? 1 : _models.Select(x => x.Id).Max() + 1;
_models.Add(model);
Success("Your information was saved!");
return RedirectToAction("Index");
}
Error("there were some errors in your form.");
return View(model);
}
开发者ID:erangeljr,项目名称:newrelic-dot-net-kata,代码行数:12,代码来源:ProductController.cs
示例11: Insert
public ActionResult Insert()
{
using (var db = new NorthwindDataContext())
{
var product = new Product();
if (TryUpdateModel(product))
{
db.Products.InsertOnSubmit(product);
db.SubmitChanges();
}
}
return GetView();
}
开发者ID:mwassem,项目名称:extensions-for-asp-net-mvc-discontinued,代码行数:13,代码来源:HomeController.cs
示例12: Create
public ActionResult Create(Product product)
{
try
{
productRepository.Add(product);
productRepository.Save();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
开发者ID:jchannon,项目名称:EntityFrameworkMVC,代码行数:13,代码来源:ProductController.cs
示例13: InsertProduct
public string InsertProduct(Product product)
{
try
{
GarageEntities db = new GarageEntities();
db.Products.Add(product);
db.SaveChanges();
return product.Name + " was succesfully inserted";
}
catch (Exception e)
{
return "Error:" + e;
}
}
开发者ID:henrypedersen77,项目名称:GarageManagerMaster,代码行数:15,代码来源:ProductModel.cs
示例14: Create
public ActionResult Create(Product product,HttpPostedFileBase file,FormCollection values)
{
if (ModelState.IsValid)
{
if (file != null)
{
product.ProductStores = new List<ProductStore>();
product.ProductStores.Add(new ProductStore { SellPrice = Convert.ToDecimal(values["SellPrice"]), TimeCreated = DateTime.Now, });
product.Image = new byte[file.ContentLength];
file.InputStream.Read(product.Image, 0, file.ContentLength);
storeDB.Products.Add(product);
storeDB.SaveChanges();
}
return RedirectToAction("");
}
ViewBag.CategorieID = new SelectList(storeDB.Caegories, "CategorieID", "Name");
return View();
}
开发者ID:alireza1735,项目名称:TGH,代码行数:18,代码来源:ProductController.cs
示例15: ListAll
public List<Product> ListAll()
{
_products = new List<Product>();
string[] reader = File.ReadAllLines(FilePath);
for (int i = 1; i < reader.Length; i++)
{
var columns = reader[i].Split(',');
var product = new Product
{
ProductType = columns[0],
CostPerSquareFoot= decimal.Parse(columns[1]),
LaborCostPerSquareFoot = decimal.Parse(columns[2]),
};
_products.Add(product);
}
return _products;
}
开发者ID:jmullins1992,项目名称:Portfolio,代码行数:21,代码来源:ProductRepository.cs
示例16: AddToCart
public void AddToCart(Product product,HttpContextBase context)
{
var cartItem = storeDB.Carts.SingleOrDefault(a => a.CartID == ShopingCartID && a.ProductID == product.ProductID);
if (cartItem == null)
{
cartItem = new Carts
{
ProductID = product.ProductID,
CartID = ShopingCartID,
TimeCreated = DateTime.Now,
Quantity = 1,
Price = product.ProductStores.OrderBy(p => p.TimeCreated).Single().SellPrice
};
if (context.Request.IsAuthenticated && storeDB.AccessControls.SingleOrDefault(ac => ac.UserName == context.User.Identity.Name).Fellow)
cartItem.Price = product.ProductStores.OrderBy(p => p.TimeCreated).Single().FellowPrice;
storeDB.Carts.Add(cartItem);
}
else
{
cartItem.Quantity++;
}
storeDB.SaveChanges();
}
开发者ID:alireza1735,项目名称:TGH,代码行数:23,代码来源:ShoppingCart.cs
示例17: SeedProducts
public void SeedProducts(string categoryName, string productsAsString, HomeGrownBulgariaDbContext context)
{
var category = context.ProductCategories.FirstOrDefault(x => x.Name == categoryName);
if(category == null)
{
return;
}
var productsAsList = productsAsString.Split(',').Select(x=> x.Trim()).ToList();
foreach(var productName in productsAsList)
{
var product = new Product()
{
CategoryId = category.Id,
Name = productName
};
context.Products.AddOrUpdate(product);
}
context.SaveChanges();
}
开发者ID:InKolev,项目名称:HomeGrownBulgaria,代码行数:24,代码来源:ProductsSeeder.cs
示例18: ImportProductsFromCSVFile
public void ImportProductsFromCSVFile(string filename)
{
StreamReader reader = new StreamReader(filename);
while (!reader.EndOfStream)
{
string[] currentElements = reader.ReadLine().Split(',');
int vendorId = int.Parse(currentElements[0]);
string productName = currentElements[1];
int measureId = int.Parse(currentElements[2]);
decimal price = decimal.Parse(currentElements[3]);
Product product = new Product();
product.Name = productName;
product.VendorId = vendorId;
product.MeasureId = measureId;
product.BuyingPrice = price;
this.sqlServerContext.Products.Add(product);
this.sqlServerContext.SaveChanges();
}
reader.Close();
}
开发者ID:Team-Sunflower-Sunbright,项目名称:DatabaseApps-Teamwork,代码行数:24,代码来源:SQLServerDBManager.cs
示例19: ValidationOfBodyAsync
/// <summary>
/// Validates body parameters on the method. See swagger for details.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+.
/// </param>
/// <param name='id'>
/// Required int multiple of 10 from 100 to 1000.
/// </param>
/// <param name='body'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async System.Threading.Tasks.Task<Product> ValidationOfBodyAsync(this IAutoRestValidationTest operations, string resourceGroupName, int id, Product body = default(Product), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
using (var _result = await operations.ValidationOfBodyWithHttpMessagesAsync(resourceGroupName, id, body, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
开发者ID:jhancock93,项目名称:autorest,代码行数:24,代码来源:AutoRestValidationTestExtensions.cs
示例20: ValidationOfBody
/// <summary>
/// Validates body parameters on the method. See swagger for details.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+.
/// </param>
/// <param name='id'>
/// Required int multiple of 10 from 100 to 1000.
/// </param>
/// <param name='body'>
/// </param>
public static Product ValidationOfBody(this IAutoRestValidationTest operations, string resourceGroupName, int id, Product body = default(Product))
{
return System.Threading.Tasks.Task.Factory.StartNew(s => ((IAutoRestValidationTest)s).ValidationOfBodyAsync(resourceGroupName, id, body), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}
开发者ID:jhancock93,项目名称:autorest,代码行数:18,代码来源:AutoRestValidationTestExtensions.cs
注:本文中的Models.Product类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论