コード例 #1
0
 public AllNotesDetailsViewModel()
 {
     Response = new ResponseMessageViewModel();
     NoteOwner = new SimpleUserModel();
     NoteGroup = new List<SimpleGroupModel>();
     Note = new Note();
     NoteTags = new NoteTagsViewModel();
 }
コード例 #2
0
ファイル: Note.cs プロジェクト: StudentNotes/MasterRepo
 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
     };
 }
コード例 #3
0
ファイル: Note.cs プロジェクト: StudentNotes/MasterRepo
 public Note(int userId)
 {
     UserId = userId;
     NoteTags = new NoteTagsViewModel();
 }
コード例 #4
0
ファイル: Note.cs プロジェクト: StudentNotes/MasterRepo
 public Note()
 {
     NoteTags = new NoteTagsViewModel();
 }
コード例 #5
0
        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);
        }