public EventEdit(ReleaseEventSeriesContract seriesContract, IUserPermissionContext userContext) : this() { Series = seriesContract; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(userContext).ToArray(); }
public ActionResult EditSeries(SeriesEdit model, HttpPostedFileBase pictureUpload = null) { ActionResult RenderEdit() { model.AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(PermissionContext).ToArray(); return(View("EditSeries", model)); } // Note: name is allowed to be whitespace, but not empty. if (model.Names == null || model.Names.All(n => string.IsNullOrEmpty(n?.Value))) { ModelState.AddModelError("Names", "Name cannot be empty"); } if (!ModelState.IsValid) { return(RenderEdit()); } var pictureData = ParsePicture(pictureUpload, "Picture", ImagePurpose.Main); int id; try { id = queries.UpdateSeries(model.ToContract(), pictureData); } catch (DuplicateEventNameException x) { ModelState.AddModelError("Names", x.Message); return(RenderEdit()); } return(RedirectToAction("SeriesDetails", new { id })); }
public void CopyNonEditableProperties(TagForEditContract contract, IUserPermissionContext permissionContext) { AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext).ToArray(); CanDelete = contract.CanDelete; CurrentName = contract.Name; Deleted = contract.Deleted; Id = contract.Id; IsEmpty = contract.IsEmpty; Thumb = contract.Thumb; UrlSlug = contract.UrlSlug; string GetTagTargetTypeName(TagTargetTypes t) { switch (t) { case TagTargetTypes.Nothing: return("Nothing"); case TagTargetTypes.All: return("Anything"); } return(string.Join(", ", EnumVal <EntryType> .Values.Where(e => e != EntryType.Undefined).Where(e => t.HasFlag((TagTargetTypes)e)).Select(e => Translate.EntryTypeNames[e]))); } AllTagTargetTypes = new[] { TagTargetTypes.Album, TagTargetTypes.Artist, TagTargetTypes.Song, TagTargetTypes.Event } .ToDictionary(t => t, GetTagTargetTypeName); }
public void CopyNonEditableProperties(ReleaseEventSeriesForEditContract contract, IUserPermissionContext userContext) { AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(userContext).ToArray(); if (contract != null) { Deleted = contract.Deleted; } }
public void CopyNonEditableFields(ArtistForEditContract artist) { ParamIs.NotNull(() => artist); AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(MvcApplication.LoginManager); Deleted = artist.Deleted; Draft = artist.Status == EntryStatus.Draft; ValidationResult = artist.ValidationResult; }
public void CopyNonEditableFields(SongForEditContract song) { ParamIs.NotNull(() => song); AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(MvcApplication.LoginManager); Deleted = song.Deleted; Draft = song.Song.Status == EntryStatus.Draft; Name = song.Song.Name; ValidationResult = song.ValidationResult; }
public ArtistEditViewModel(ArtistContract artist, IUserPermissionContext permissionContext, ArtistForEditContract editedArtist = null) : this() { ParamIs.NotNull(() => artist); Artist = artist; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext); EditedArtist = editedArtist; }
public SongEditViewModel(SongContract song, IUserPermissionContext permissionContext, SongForEditContract editedSong = null) : this() { ParamIs.NotNull(() => song); Song = song; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext); EditedSong = editedSong; }
public AlbumEditViewModel(AlbumContract album, IUserPermissionContext permissionContext, AlbumForEditContract editedAlbum = null) : this() { ParamIs.NotNull(() => album); Album = album; EditedAlbum = editedAlbum; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext); }
public void CopyNonEditableProperties(TagForEditContract contract, IUserPermissionContext permissionContext) { AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext).ToArray(); CanDelete = contract.CanDelete; CurrentName = contract.Name; Deleted = contract.Deleted; Id = contract.Id; IsEmpty = contract.IsEmpty; Thumb = contract.Thumb; UrlSlug = contract.UrlSlug; }
public void CopyNonEditableProperties(ReleaseEventDetailsContract contract, IUserPermissionContext userContext) { AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(userContext).ToArray(); if (contract != null) { Deleted = contract.Deleted; OldName = contract.Name; PictureMime = contract.PictureMime; UrlSlug = contract.UrlSlug; Version = contract.Version; } }
public void CopyNonEditableFields(AlbumForEditContract album) { ParamIs.NotNull(() => album); AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(MvcApplication.LoginManager); ArtistLinks = album.ArtistLinks; Deleted = album.Deleted; Draft = album.Status == EntryStatus.Draft; NameEnglish = album.TranslatedName.English; NameJapanese = album.TranslatedName.Japanese; NameRomaji = album.TranslatedName.Romaji; ValidationResult = album.ValidationResult; }
public SongEditViewModel(SongContract song, IUserPermissionContext permissionContext, bool canDelete, SongForEditContract editedSong = null, int?albumId = null) : this() { ParamIs.NotNull(() => song); Song = song; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext).ToArray(); CanDelete = canDelete; EditedSong = editedSong; AlbumId = albumId; }
public VenueEditViewModel(VenueForEditContract contract, IUserPermissionContext permissionContext) { ParamIs.NotNull(() => contract); Address = contract.Address; AddressCountryCode = contract.AddressCountryCode; Coordinates = contract.Coordinates; DefaultNameLanguage = contract.DefaultNameLanguage; Deleted = contract.Deleted; Description = contract.Description; Id = contract.Id; Name = contract.Name; Names = contract.Names; Status = contract.Status; WebLinks = contract.WebLinks; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext).ToArray(); }
public ActionResult Edit(VenueEditViewModel model) { // Note: name is allowed to be whitespace, but not empty. if (model.Names == null || model.Names.All(n => string.IsNullOrEmpty(n?.Value))) { ModelState.AddModelError("Names", "Name cannot be empty"); } if ((model.Coordinates != null) && !OptionalGeoPoint.IsValid(model.Coordinates.Latitude, model.Coordinates.Longitude)) { ModelState.AddModelError("Coordinates", "Invalid coordinates"); } if (!ModelState.IsValid) { model.AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(PermissionContext).ToArray(); return(View(model)); } var id = queries.Update(model.ToContract()); return(RedirectToAction("Details", new { id })); }
public TagEdit() { AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(MvcApplication.LoginManager).Where(e => e != EntryStatus.Draft).ToArray(); }