public ActionResult CreatePart(string id) { ContentPartModel partModel = new ContentPartModel() { IsActive = true, Mode = ViewModelMode.Creation }; return base.View("CreateOrUpdatePart", partModel); }
public ContentPart CreateContentPart(ContentPartModel partModel) { var cp = new ContentPart() { Name = partModel.Name, Details = partModel.Details, IsActive = partModel.IsActive, }; cp.AddLogCreation(); return cp; }
public void UpdateContentPart(ContentPart contentPart, ContentPartModel partModel) { contentPart.Name = partModel.Name; contentPart.Details = partModel.Details; contentPart.IsActive = partModel.IsActive; contentPart.AddLog("Update Content part", string.Empty); contentPart.ContentItem.AddLog("Update Content part", string.Empty); }
public ContentPartModel GetContentPartModel(ContentPart contentPart) { var model = new ContentPartModel(); model.Initialize(contentPart); return model; }
public ActionResult CreatePart(string id, ContentPartModel partModel, FormCollection collection) { if (base.ModelState.IsValid) { var contentItem = this.contentItemRepository.GetById(new Guid(id)); if (contentItem != null) { var partItem = this.contentModelsService.CreateContentPart(partModel); contentItem.AddPart(partItem); this.contentBonusService.CalculateTotalPoints(DomainSessionContext.Instance.CurrentUser); return base.RedirectToAction(ControllerAssistant.GetActionName(() => this.Details(id)), ControllerAssistant.BuildRouteValues(id)); } } return base.View("CreateOrUpdatePart", partModel); }
public ActionResult EditPart(string id, string cid, ContentPartModel partModel, FormCollection collection) { if (base.ModelState.IsValid) { var contentPart = this.contentModelsService.GetContentPart(id, cid); if (contentPart != null) { this.contentModelsService.UpdateContentPart(contentPart, partModel); this.contentBonusService.CalculateTotalPoints(DomainSessionContext.Instance.CurrentUser); return base.RedirectToAction(ControllerAssistant.GetActionName(() => this.Details(cid)), new { id = cid }); } } return base.View("CreateOrUpdatePart", partModel); }