public JsonResult HandlePartyImageForm(PartyImageForm partyImageForm) { FormResponse formResponse = new FormResponse(); if (this.ModelState.IsValid) { PartyHost partyHost = (PartyHost)this.Members.GetCurrentPartier(); IPartyImage partyImage = (IPartyImage)this.Umbraco.TypedMedia(partyImageForm.PartyImage); // if new image is a csm default and old is a custom upload, then delete the custom upload if (partyImage is Image & partyHost.PartyImage is PartyImage) { partyHost.PartyImage = null; } // set new partyHost.PartyImage = partyImage; formResponse.Success = true; } else { formResponse.Errors = this.ModelState.GetErrors(); } return(Json(formResponse, "text/plain")); }
public ActionResult RenderPartyImageForm() { PartyImageForm partyImageForm = new PartyImageForm(); partyImageForm.DefaultImages = ((Party)this.CurrentPage).DefaultImages; return(this.PartialView("Party/Forms/PartyImageForm", partyImageForm)); }