public AllNotesDetailsViewModel() { Response = new ResponseMessageViewModel(); NoteOwner = new SimpleUserModel(); NoteGroup = new List<SimpleGroupModel>(); Note = new Note(); NoteTags = new NoteTagsViewModel(); }
public Note(File file) { UserId = file.UserId; NoteId = file.FileId; Name = file.Name; Category = file.Category; DestinationPath = file.Path; Size = file.Size; UploadDate = file.UploadDate; IsShared = file.IsShared; Tags = file.FileTags; NoteTags = new NoteTagsViewModel() { NoteId = file.FileId, Tags = file.FileTags }; }
public Note(int userId) { UserId = userId; NoteTags = new NoteTagsViewModel(); }
public Note() { NoteTags = new NoteTagsViewModel(); }
public ActionResult RemoveTagFromNote(int noteId, string tagName) { var model = new NoteTagsViewModel {NoteId = noteId}; var isValid = true; if (tagName.IsEmpty()) { model.Response.AddError(ResourceKeyResolver.ErrorNoTagChoosen); isValid = false; } if (!_fileService.TagExistsInDatabase(tagName)) { model.Response.AddError(ResourceKeyResolver.ErrorTagDoesntExist); isValid = false; } if (!_fileService.FileHasTag(noteId, tagName)) { model.Response.AddError(ResourceKeyResolver.ErrorNoteHasNoTag); isValid = false; } if (!isValid) { model.Tags = _fileService.GetFileById(noteId).FileTags; return PartialView("~/Views/Partials/ManageNotes/NoteTagsPartial.cshtml", model); } _fileService.RemoveTagFromFile(noteId, tagName); _unitOfWork.Commit(); model.Tags = _fileService.GetFileById(noteId).FileTags; return PartialView("~/Views/Partials/ManageNotes/NoteTagsPartial.cshtml", model); }