public async Task <IActionResult> Edit(ContentListFileViewModel model, int id) { var content = await _contentListFileService.FindByIdAsync(id).ConfigureAwait(false); content.Title = model.Title == null ? "":model.Title.Trim(); content.Mp364 = model.Mp364; content.Mp3128 = model.Mp3128; content.Mp3320 = model.Mp3320; content.Type = model.Type; content.VisitCount = model.VisitCount; content.LikeCount = model.LikeCount; content.Order = model.Order; content.ContentListId = model.ContentListId; _contentListFileService.UpdateContentListFile(content, model.File1, model.File2, model.File3); return(RedirectToAction(nameof(Index), new { type = content.Type })); }
public ActionResult Create(ContentListFileViewModel model) { if (ModelState.IsValid) { var contentFile = new ContentListFile { VisitCount = 0, LikeCount = 0, FileSize = 0, Title = model.Title, Type = "1", ContentListId = model.ContentListId, Order = model.Order }; _contentListFileService.AddNewContentListFile(contentFile, model.File1, model.File2, model.File3); return(RedirectToAction(nameof(Index), new { type = contentFile.Type })); } return(View(model)); }
public ActionResult Edit(string type, int id) { var c = _contentListFileService.FindByIdAsync(id).Result; var m = new ContentListFileViewModel { Title = c.Title, Id = c.Id, Mp364 = c.Mp364, Mp3128 = c.Mp3128, Mp3320 = c.Mp3320, LikeCount = c.LikeCount, VisitCount = c.VisitCount, Type = c.Type, ContentListId = c.ContentListId, Order = c.Order }; ViewBag.ContentListName = c.ContentList.Title; return(View(m)); }