public AllNotesDetailsViewModel()
 {
     Response = new ResponseMessageViewModel();
     NoteOwner = new SimpleUserModel();
     NoteGroup = new List<SimpleGroupModel>();
     Note = new Note();
     NoteTags = new NoteTagsViewModel();
 }
Ejemplo n.º 2
0
 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
     };
 }
Ejemplo n.º 3
0
 public Note(int userId)
 {
     UserId = userId;
     NoteTags = new NoteTagsViewModel();
 }
Ejemplo n.º 4
0
 public Note()
 {
     NoteTags = new NoteTagsViewModel();
 }
Ejemplo n.º 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);
        }