本文整理汇总了C#中CheckoutAttributeModel.ToEntity方法的典型用法代码示例。如果您正苦于以下问题:C# CheckoutAttributeModel.ToEntity方法的具体用法?C# CheckoutAttributeModel.ToEntity怎么用?C# CheckoutAttributeModel.ToEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CheckoutAttributeModel
的用法示例。
在下文中一共展示了CheckoutAttributeModel.ToEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public ActionResult Create(CheckoutAttributeModel model, bool continueEditing)
{
if (!_services.Permissions.Authorize(StandardPermissionProvider.ManageCatalog))
return AccessDeniedView();
if (ModelState.IsValid)
{
var checkoutAttribute = model.ToEntity();
_checkoutAttributeService.InsertCheckoutAttribute(checkoutAttribute);
UpdateAttributeLocales(checkoutAttribute, model);
//activity log
_customerActivityService.InsertActivity("AddNewCheckoutAttribute", _services.Localization.GetResource("ActivityLog.AddNewCheckoutAttribute"), checkoutAttribute.Name);
NotifySuccess(_services.Localization.GetResource("Admin.Catalog.Attributes.CheckoutAttributes.Added"));
return continueEditing ? RedirectToAction("Edit", new { id = checkoutAttribute.Id }) : RedirectToAction("List");
}
//If we got this far, something failed, redisplay form
PrepareCheckoutAttributeModel(model, null, true);
return View(model);
}
示例2: Edit
public ActionResult Edit(CheckoutAttributeModel model, bool continueEditing)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes))
return AccessDeniedView();
var checkoutAttribute = _checkoutAttributeService.GetCheckoutAttributeById(model.Id);
if (checkoutAttribute == null)
//No checkout attribute found with the specified id
return RedirectToAction("List");
if (ModelState.IsValid)
{
checkoutAttribute = model.ToEntity(checkoutAttribute);
_checkoutAttributeService.UpdateCheckoutAttribute(checkoutAttribute);
//locales
UpdateAttributeLocales(checkoutAttribute, model);
//Stores
SaveStoreMappings(checkoutAttribute, model);
//activity log
_customerActivityService.InsertActivity("EditCheckoutAttribute", _localizationService.GetResource("ActivityLog.EditCheckoutAttribute"), checkoutAttribute.Name);
SuccessNotification(_localizationService.GetResource("Admin.Catalog.Attributes.CheckoutAttributes.Updated"));
if (continueEditing)
{
//selected tab
SaveSelectedTabIndex();
return RedirectToAction("Edit", new {id = checkoutAttribute.ID});
}
return RedirectToAction("List");
}
//If we got this far, something failed, redisplay form
//tax categories
PrepareTaxCategories(model, checkoutAttribute, true);
//Stores
PrepareStoresMappingModel(model, checkoutAttribute, true);
return View(model);
}
示例3: Create
public ActionResult Create(CheckoutAttributeModel model, bool continueEditing)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes))
return AccessDeniedView();
if (ModelState.IsValid)
{
var checkoutAttribute = model.ToEntity();
_checkoutAttributeService.InsertCheckoutAttribute(checkoutAttribute);
//locales
UpdateAttributeLocales(checkoutAttribute, model);
//Stores
SaveStoreMappings(checkoutAttribute, model);
//activity log
_customerActivityService.InsertActivity("AddNewCheckoutAttribute", _localizationService.GetResource("ActivityLog.AddNewCheckoutAttribute"), checkoutAttribute.Name);
SuccessNotification(_localizationService.GetResource("Admin.Catalog.Attributes.CheckoutAttributes.Added"));
return continueEditing ? RedirectToAction("Edit", new { id = checkoutAttribute.ID }) : RedirectToAction("List");
}
//If we got this far, something failed, redisplay form
//tax categories
PrepareTaxCategories(model, null, true);
//Stores
PrepareStoresMappingModel(model, null, true);
return View(model);
}
示例4: Edit
public ActionResult Edit(CheckoutAttributeModel model, bool continueEditing)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
return AccessDeniedView();
var checkoutAttribute = _checkoutAttributeService.GetCheckoutAttributeById(model.Id);
if (checkoutAttribute == null)
throw new ArgumentException("No checkout attribute found with the specified id");
if (ModelState.IsValid)
{
checkoutAttribute = model.ToEntity(checkoutAttribute);
_checkoutAttributeService.UpdateCheckoutAttribute(checkoutAttribute);
UpdateAttributeLocales(checkoutAttribute, model);
//activity log
_customerActivityService.InsertActivity("EditCheckoutAttribute", _localizationService.GetResource("ActivityLog.EditCheckoutAttribute"), checkoutAttribute.Name);
SuccessNotification(_localizationService.GetResource("Admin.Catalog.Attributes.CheckoutAttributes.Updated"));
return continueEditing ? RedirectToAction("Edit", checkoutAttribute.Id) : RedirectToAction("List");
}
//If we got this far, something failed, redisplay form
PrepareCheckoutAttributeModel(model, checkoutAttribute, true);
return View(model);
}