本文整理汇总了C#中CategoryModel类的典型用法代码示例。如果您正苦于以下问题:C#CategoryModel类的具体用法?C#CategoryModel怎么用?C#CategoryModel使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:AddCategory
publicasyncTask
AddCategory(CategoryModelmodel)
{
try
{
varcategory=newDrNajeeb.EF.Category();
category.Name=model.Name;
category.IsShowOnFrontPage=model.IsShowOnFrontPage??false;
category.SEOName=Helpers.URLHelpers.URLFriendly(model.Name);
category.CreatedOn=DateTime.UtcNow;
category.Active=true;
varmaxValue=await_Uow._Categories.GetAll(x=>x.Active==true).OrderByDescending(x=>x.DisplayOrder).FirstOrDefaultAsync();
category.DisplayOrder=(maxValue!=null)?maxValue.DisplayOrder+1:1;
//todo:adduseidincreatedby
//todo:setseonamelikeQAsite
//todo:setandsavecategoryurl
//setdisplayorderofcategories
_Uow._Categories.Add(category);
await_Uow.CommitAsync();
returnOk();
}
catch(Exceptionex)
{
returnInternalServerError(ex);
}
}
原文链接:http://www.jxszl.com/biancheng/C/556688.html