本文整理汇总了C#中Widget.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Widget.Update方法的具体用法?C# Widget.Update怎么用?C# Widget.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveProductImage
public ActionResult SaveProductImage() {
Guid widgetID=new Guid(Request.Form["widgetid"]);
Guid pageID = new Guid(Request.Form["pageid"]);
if (Request.Files.Count > 0) {
var item = Request.Files[0] as HttpPostedFileBase;
string fileExtension=Path.GetExtension(item.FileName);
string fileName=Path.GetFileName(item.FileName);
string filePath=Path.Combine(Server.MapPath("~/content/images"),fileName);
item.SaveAs(filePath);
//now that the file's uploaded, save the file name as the body of the widget
var widget = new Widget(widgetID);
widget.Body = fileName;
widget.ModifiedOn = DateTime.Now;
widget.Update(User.Identity.Name);
}
return RedirectToAction("Edit", new { id = pageID });
}
示例2: SaveWidget
public ActionResult SaveWidget(Widget widget) {
//pull the widget to keep the data current
Widget existing = new Widget(widget.WidgetID);
existing.ModifiedOn = DateTime.Now;
existing.ModifiedBy = User.Identity.Name;
existing.Title = widget.Title;
if (!string.IsNullOrEmpty(widget.Body))
existing.Body = widget.Body;
//_cmsRepository.SaveWidget(existing);
existing.Update(User.Identity.Name);
return new EmptyResult();
}
示例3: SaveProductWidget
public ActionResult SaveProductWidget() {
var widgetID = Request.Form["widgetid"] ?? "";
if (!string.IsNullOrEmpty(widgetID)) {
//pull out all sku's
var skus = Request.Form.GetValues("sku");
var widget = new Widget(new Guid(widgetID));
widget.SKUList = skus.ToString();
widget.Update(User.Identity.Name);
}
return new EmptyResult();
}