/// <summary>
        /// Inicializuje menu zobrazení seznamu publikací.
        /// </summary>
        /// <param name="publicationTypes">typy publikací</param>
        /// <param name="publicationModel">správce publikací</param>
        public ListPublicationMenu(List <PublicationType> publicationTypes, PublicationModel publicationModel, AuthorModel authorModel)
        {
            this.publicationTypes = publicationTypes;
            this.publicationModel = publicationModel;
            this.authorModel      = authorModel;

            MenuLabel = "Menu zobrazení seznamu publikací";
            InitializeMenuItems(new Dictionary <ConsoleKey, MenuItem>()
            {
                { ConsoleKey.A, new MenuItem()
                  {
                      Name = "Author", Description = "Přidá filtr pro autora se zadaným ID.", UIMethod = AddAuthorFilter
                  } },
                { ConsoleKey.Y, new MenuItem()
                  {
                      Name = "Year", Description = "Přidá filtr pro zadaný rok vydání.", UIMethod = AddYearFilter
                  } },
                { ConsoleKey.T, new MenuItem()
                  {
                      Name = "Type", Description = "Přidá filtr pro zadaný typ publikace.", UIMethod = AddTypeFilter
                  } },
                { ConsoleKey.L, new MenuItem()
                  {
                      Name = "List", Description = "Vypíše seznam se zadanými filtry a odstraní seznam filtrů.", UIMethod = PrintFilteredPublicationList
                  } },
            });
        }
Exemplo n.º 2
0
        private async void UploadMainVideoBtn_Click(object sender, EventArgs e)
        {
            _logger.LogTrace($"{GetType()} - BEGIN {nameof(UploadMainVideoBtn_Click)}");
            if (!CheckSelectedRow())
            {
                return;
            }

            Progress <UploadStatusModel> progress = new Progress <UploadStatusModel>(status => {
                UploadProgressBar.Value = (int)status.CompletionRate;
                ProgressLabel.Text      = $"{status.CompletionRate}% ({status.StatusText})";
            });

            DataGridViewRow  row = VideoDGV.SelectedRows[0];
            PublicationModel publicationModel = row.DataBoundItem as PublicationModel;

            DialogResult result = VideoFileDialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                VideoModel videoModel = new VideoModel()
                {
                    Metadata    = publicationModel.MainVideo,
                    VideoStream = VideoFileDialog.OpenFile()
                };

                await Task.Run(() => { _videoService.UploadVideoAsync(videoModel, progress, CancellationToken.None); });
            }
            else
            {
                MessageBox.Show("OK on fera ça plus tard 😉");
            }
        }
Exemplo n.º 3
0
        private async void UpdateAirtableForLiveDataBtn_Click(object sender, EventArgs e)
        {
            _logger.LogTrace($"{GetType()} - BEGIN {nameof(UpdateAirtableForLiveDataBtn_Click)}");
            if (!CheckSelectedRow())
            {
                return;
            }

            VideoMetadataModel res = await _videoService.GetUpcomingLiveAsync(CancellationToken.None);

            if (res != null && !string.IsNullOrEmpty(res.VideoUrl))
            {
                foreach (DataGridViewRow row in VideoDGV.SelectedRows)
                {
                    PublicationModel model = row.DataBoundItem as PublicationModel;
                    //model.LiveVideo.Identifier = res.Identifier;
                    model.LiveVideo.VideoUrl = res.VideoUrl;

                    //if (await _dataService.UpdateLiveVideoRecord(model.Id, model.LiveVideo))
                    //{
                    //    MessageBox.Show("Airtable a été mis à jour");
                    //}
                    //else
                    //{
                    //    MessageBox.Show("Problème pendant la mise à jour de Airtable");

                    //}
                }
            }
            else
            {
                MessageBox.Show("¯\\(°_o)/¯ Attention, vidéo du live non trouvée. Airtable ne sera pas mis à jour.", "Live non trouvé");
            }
        }
Exemplo n.º 4
0
        //
        // GET: /CPPublication/

        public ActionResult Publication()
        {
            ViewBag.CurrentMainTab     = "Home";
            ViewBag.CurrentSubTab      = "ControlPanel";
            ViewBag.CurrentSuperSubTab = "Publication";

            List <ProjectModel> lstProjects = new List <ProjectModel>();

            lstProjects.Add(new ProjectModel
            {
                Id    = 0,
                Title = "Associate Project"
            });


            lstProjects.AddRange(ProjectMap.Map(_repoProject.GetList().ToList()));

            List <GroupModel> lstGroups = new List <GroupModel>();

            lstGroups.Add(new GroupModel
            {
                Id    = 0,
                Title = "Associate Group"
            });


            lstGroups.AddRange(GroupMap.Map(_repoGroup.GetList().ToList()));

            PublicationModel objPublication = new PublicationModel();

            objPublication.Projects = new SelectList(lstProjects, "Id", "Title");
            objPublication.Groups   = new SelectList(lstGroups, "Id", "Title");
            objPublication.IsNew    = true;
            return(View(objPublication));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Inicializuje hlavní menu.
        /// </summary>
        /// <param name="publicationTypes">typy publikací</param>
        /// <param name="publicationModel">správce publikací</param>
        /// <param name="authorModel">správce autorů</param>
        /// <param name="attachmentModel">správce příloh</param>
        public MainMenu(List <PublicationType> publicationTypes, PublicationModel publicationModel, AuthorModel authorModel, AttachmentModel attachmentModel)
        {
            this.publicationTypes = publicationTypes;
            this.publicationModel = publicationModel;
            this.authorModel      = authorModel;
            this.attachmentModel  = attachmentModel;

            MenuLabel = "Hlavní menu";
            InitializeMenuItems(new Dictionary <ConsoleKey, MenuItem>()
            {
                { ConsoleKey.L, new MenuItem()
                  {
                      Name = "List", Description = "Zobrazí menu výpisu publikací se zadanými filtry.", UIMethod = GetPublicationList
                  } },
                { ConsoleKey.R, new MenuItem()
                  {
                      Name = "Read", Description = "Načte detail zadané publikace, kterou lze upravit nebo odstranit.", UIMethod = GetPublicationDetail
                  } },
                { ConsoleKey.C, new MenuItem()
                  {
                      Name = "Create", Description = "Vytvoří novou publikaci.", UIMethod = CreateNewPublication
                  } },
                { ConsoleKey.A, new MenuItem()
                  {
                      Name = "Authors", Description = "Zobrazí menu výpisu uložených autorů.", UIMethod = GetAuthorList
                  } },
                { ConsoleKey.I, new MenuItem()
                  {
                      Name = "Info", Description = "Vypíše stručný popis programu.", UIMethod = PrintInfo
                  } },
            });

            MenuItems[ConsoleKey.H].Description = "Ukončí program.";
        }
        public ActionResult AddPublication(PublicationModel publication)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    PublicationRepository publicationRepository = new PublicationRepository();
                    publicationRepository.AddPublication(publication);

                    var profileData = Session["UserProfile"] as UserSession;
                    var logModel    = new LogModel
                    {
                        UserId    = profileData.UserID,
                        TableName = "Publication",
                        Activity  = "Added Publication",
                        LogDate   = DateTime.Now
                    };
                    var logRepository = new logRepository();
                    logRepository.AddLog(logModel);
                }

                return(RedirectToAction("GetAllPublicationDetails"));
            }
            catch
            {
                return(RedirectToAction("GetAllPublicationDetails"));
            }
        }
        //
        // GET: /PublicationModel/Delete/5

        public ActionResult Delete(int id)
        {
            UserProfile      userprofile      = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name);
            PublicationModel publicationmodel = followPeersDB.PublicationModels.Find(id);

            foreach (var forums in followPeersDB.Forums)
            {
                //var currentForumTopic = followPeersDB.ForumTopics.SingleOrDefault(t => t. == currentuser);
                List <ForumTopic> topics = forums.Topics.ToList();
                foreach (var topic in topics)
                {
                    if (topic.createdUser != null && topic.createdUser == userprofile && topic.groupId == id.ToString())
                    {
                        List <ForumPost> posts = followPeersDB.ForumPosts.ToList();
                        foreach (var post in posts)
                        {
                            if (topic.Posts.Contains(post))
                            {
                                followPeersDB.ForumPosts.Remove(post);
                            }
                        }
                        followPeersDB.ForumTopics.Remove(topic);
                    }
                }
            }
            return(View(publicationmodel));
        }
        public ActionResult Unlike(int id)
        {
            PublicationModel publicationmodel = followPeersDB.PublicationModels.Find(id);

            if (publicationmodel.Likes != 0)
            {
                publicationmodel.Likes = publicationmodel.Likes - 1;
            }

            string      name = Membership.GetUser().UserName;
            int         userID;
            UserProfile user = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name);

            userID = user.UserProfileId;

            AchievementLike achievementmodel = followPeersDB.AchievementLikes.SingleOrDefault(p => p.AchievementId == id && p.UserProfileId == userID);

            try
            {
                followPeersDB.AchievementLikes.Remove(achievementmodel);
            }
            catch
            {
            }
            followPeersDB.SaveChanges();
            return(RedirectToAction("Details", "PublicationModel", new { id = id }));
        }
Exemplo n.º 9
0
 public ActionResult Publication(PublicationModel objPublication)
 {
     try
     {
         ViewBag.DisciplineId = new SelectList(_repoDiscipline.GetList().ToList(), "Id", "DisciplineName", "");
         if (ModelState.IsValid)
         {
             if (objPublication.IsNew == true)
             {
                 objPublication.CreatedBy   = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId).Id;
                 objPublication.CreatedDate = DateTime.Now;
                 _repoPublication.Add(PublicationMap.Map(objPublication));
                 objPublication.IsNew = false;
             }
             else
             {
             }
             _repoPublication.Save();
         }
         else
         {
             TempData[LeonniConstants.ErrorMessage] = " Update Unsuccessful";
             return(View(objPublication));
         }
         TempData[LeonniConstants.SuccessMessage] = "Profile Updated Successfully";
         return(RedirectToAction("Publication"));
     }
     catch (Exception e)
     {
         TempData[LeonniConstants.ErrorMessage] = e.ToString();
         return(View(objPublication));
     }
 }
Exemplo n.º 10
0
        public async Task <PublicationModel> UpdatePublication(PublicationModel publicationModel, [ScopedService] LibraryDbContext context)
        {
            context.Publications.Update(publicationModel);
            await context.SaveChangesAsync();

            return(publicationModel);
        }
        public PublicationModel GetByPublicationId(int id)
        {
            Connection();
            List <PublicationModel> publicationList  = new List <PublicationModel>();
            PublicationModel        publicationModel = new PublicationModel();
            SqlCommand command = new SqlCommand("GetPublicationByID", _connect);

            command.Parameters.AddWithValue("@PublicationID", id);
            command.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
            DataTable      dataTable   = new DataTable();

            _connect.Open();
            dataAdapter.Fill(dataTable);
            _connect.Close();

            //Bind AuthorModel generic list using LINQ
            publicationList = (from DataRow dataRow in dataTable.Rows

                               select new PublicationModel()
            {
                PublicationId = Convert.ToInt32(dataRow["PublicationID"]),
                PublicationName = Convert.ToString(dataRow["PublicationName"]),
            }).ToList();

            publicationModel = publicationList[0];

            return(publicationModel);
        }
Exemplo n.º 12
0
        public ActionResult Rank(int id, int pubId)
        {
            PublicationModel publicationmodel = followPeersDB.PublicationModels.Find(pubId);

            publicationmodel.Rank = (publicationmodel.Rank + id) / 2;
            followPeersDB.SaveChanges();
            return(Json(pubId));
        }
Exemplo n.º 13
0
        public ActionResult DeleteConfirmed(int id)
        {
            PublicationModel publicationmodel = followPeersDB.PublicationModels.Find(id);

            followPeersDB.PublicationModels.Remove(publicationmodel);
            followPeersDB.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 14
0
        public async Task <ActionResult> Create(PublicationViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

            if (user != null)
            {
                await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                byte[] buffer = new byte[4];
                RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
                rng.GetBytes(buffer);
                int Token = BitConverter.ToInt32(buffer, 0);


                var upload = model.Files[0];
                if (upload == null)
                {
                    return(RedirectToAction("Index"));
                }

                // получаем имя файла
                string fileName = System.IO.Path.GetFileName(upload.FileName);
                // сохраняем файл в папку Files в проекте
                var  subPath   = Server.MapPath("~/Files/" + user.Nickname);
                bool subExists = System.IO.Directory.Exists(subPath);
                if (!subExists)
                {
                    System.IO.Directory.CreateDirectory(subPath);
                }


                upload.SaveAs(Server.MapPath("~/Files/" + user.Nickname + "/" + Token + fileName));

                var Publication = new PublicationModel
                {
                    Name       = model.Name,
                    Author     = model.Author,
                    Year       = model.Year,
                    Theme      = model.Theme,
                    Annotation = model.Annotation,
                    Nickname   = user.Nickname,
                    Token      = Token,
                    FileName   = upload.FileName,
                    Path       = Server.MapPath("~/Files/" + user.Nickname + "/" + Token + fileName),
                };
                db.Publications.Add(Publication);
                db.SaveChanges();
                return(RedirectToAction("Index", new { Message = ManageMessageId.CreatePublicationSuccess }));
            }

            return(View(model));
        }
Exemplo n.º 15
0
 public ActionResult Edit(PublicationModel publicationmodel)
 {
     if (ModelState.IsValid)
     {
         followPeersDB.Entry(publicationmodel).State = EntityState.Modified;
         followPeersDB.SaveChanges();
         return(RedirectToAction("MyPublication"));
     }
     return(View(publicationmodel));
 }
Exemplo n.º 16
0
        public ActionResult AddTopic(int id)
        {
            ViewBag.pubId = id;
            PublicationModel pub = followPeersDB.PublicationModels.SingleOrDefault(p => p.publicationID == id);

            ViewBag.CategoryList = followPeersDB.Specializations.Select(s => s.SpecializationName).ToList();
            ViewData["Category"] = pub.specialisation;
            pubcategory          = id;
            return(View());
        }
Exemplo n.º 17
0
        public ActionResult Unlike(int id, int pubId, string NameId)
        {
            PublicationModel publicationmodel = followPeersDB.PublicationModels.Find(pubId);

            publicationmodel.Likes = publicationmodel.Likes - 1;
            AchievementLike achievementmodel = followPeersDB.AchievementLikes.Find(id);

            followPeersDB.AchievementLikes.Remove(achievementmodel);
            followPeersDB.SaveChanges();
            return(Json(id));
        }
        public ActionResult Edit(PublicationModel publicationmodel)
        {
            var errors = ModelState.Values.SelectMany(v => v.Errors);

            if (ModelState.IsValid)
            {
                followPeersDB.Entry(publicationmodel).State = EntityState.Modified;
                followPeersDB.SaveChanges();
                return(RedirectToAction("Details", "PublicationModel", new { message = "Publication Successfully Edited", id = publicationmodel.publicationID }));
            }
            return(View(publicationmodel));
        }
Exemplo n.º 19
0
        public IActionResult DishPage(Publication publication)
        {
            PublicationModel publicationModel = new PublicationModel();
            User             user             = GetInfo(publication.UserId);
            var cat      = db.Categories.FirstOrDefault(c => c.Id == publication.CategoryId);
            var photos   = db.PublicationPhotos.Where(p => p.PublicationId == publication.Id);
            var comments = db.Comments.Include(x => x.User).Where(c => c.PublicationId == publication.Id);

            publicationModel.Photos      = photos;
            publicationModel.Publication = publication;
            publicationModel.User        = user;
            publicationModel.Category    = cat;
            publicationModel.Comments    = comments;
            return(View(publicationModel));
        }
        /// <summary>
        /// Inicializuje menu správy publikace.
        /// </summary>
        /// <param name="publicationTypes">typy publikací</param>
        /// <param name="publicationModel">správce publikací</param>
        /// <param name="authorModel">správce autorů</param>
        /// <param name="attachmentModel">správce příloh</param>
        /// <param name="publicationId">ID publikace</param>
        public PublicationMainMenu(List <PublicationType> publicationTypes, PublicationModel publicationModel, AuthorModel authorModel, AttachmentModel attachmentModel, int publicationId)
        {
            this.publicationTypes = publicationTypes;
            this.publicationModel = publicationModel;
            this.authorModel      = authorModel;
            this.attachmentModel  = attachmentModel;
            this.publicationId    = publicationId;

            MenuLabel = "Menu správy publikace č. " + publicationId;
            InitializeMenuItems(new Dictionary <ConsoleKey, MenuItem>()
            {
                { ConsoleKey.R, new MenuItem()
                  {
                      Name = "Read", Description = "Znovu vypíše bibliografické údaje zobrazené publikace.", UIMethod = GetBibliography
                  } },
                { ConsoleKey.U, new MenuItem()
                  {
                      Name = "Update", Description = "Spustí průvodce úpravou zobrazené publikace.", UIMethod = UpdateBibliography
                  } },
                { ConsoleKey.D, new MenuItem()
                  {
                      Name = "Delete", Description = "Odstraní zobrazenou publikaci (vyžaduje potvrzení).", UIMethod = DeletePublication
                  } },
                { ConsoleKey.T, new MenuItem()
                  {
                      Name = "Text", Description = "Vypíše obsah (hlavní text) zobrazené publikace.", UIMethod = PrintContentText
                  } },
                { ConsoleKey.F, new MenuItem()
                  {
                      Name = "Files", Description = "Přepne do menu správy příloh (umožňuje přidávat a odebírat přílohy publikace).", UIMethod = UpdateAttachments
                  } },
                { ConsoleKey.I, new MenuItem()
                  {
                      Name = "ISO", Description = "Vygeneruje citaci zobrazené publikace podle normy ČSN ISO 690.", UIMethod = PrintIsoCitation
                  } },
                { ConsoleKey.B, new MenuItem()
                  {
                      Name = "BibTeX", Description = "Vygeneruje BibTeX záznam zobrazené publikace odpovídající citaci podle normy.", UIMethod = PrintBibtexEntry
                  } },
                { ConsoleKey.E, new MenuItem()
                  {
                      Name = "Export", Description = "Exportuje zobrazenou publikaci do souboru ve formátu HTML.", UIMethod = PrintHtmlDocument
                  } },
            });

            GetBibliography();
        }
Exemplo n.º 21
0
        // POST api/values
        public void Post(PublicationModel model)
        {
            switch (model.TYPE)
            {
            case "PagePublished":
                WebApiApplication.PulicationFinished(model.TCMUri, model.URL);
                break;

            case "ComponentUpdated":
                WebApiApplication.ComponentUpdated(model.TCMUri, model.URL);
                break;

            case "ComponentNeedTranslation":
                WebApiApplication.ComponentNeedTranslation(model.TCMUri, model.URL, model.childTCMUri, model.childTitle);
                break;
            }
        }
Exemplo n.º 22
0
        public ActionResult Recommend(int id, string NameId)
        {
            UserProfile user  = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name);
            Bookmark    model = new Bookmark();

            if (NameId != null && NameId != "")
            {
                int         recommendid = Convert.ToInt32(NameId);
                UserProfile invitee     = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserProfileId == recommendid);

                try
                {
                    if (user.UserProfileId != recommendid)
                    {
                        model.bookmarkType = "Publication";
                        model.itemID       = id;
                        model.userID       = recommendid;
                        followPeersDB.Bookmarks.Add(model);
                        followPeersDB.SaveChanges();

                        //Adding a notification item to the recommended person
                        PublicationModel book    = followPeersDB.PublicationModels.SingleOrDefault(b => b.publicationID == id);
                        Notification     newnoti = new Notification
                        {
                            message   = user.FirstName + user.LastName + " has recommeded you a publication : " + book.title,
                            link      = "/PublicationModel/Details/" + id,
                            New       = true,
                            imagelink = user.PhotoUrl,
                        };

                        invitee.Notifications.Add(newnoti);
                        followPeersDB.Entry(invitee).State = EntityState.Modified;
                        followPeersDB.SaveChanges();
                    }
                }
                catch
                {
                }
            }
            string result = "#";

            return(Json(result));
        }
Exemplo n.º 23
0
        /// <summary>
        /// Provede inicializaci objektů datové vrstvy a spustí program v režimu hlavního menu.
        /// </summary>
        /// <param name="args">parametry příkazového řádku</param>
        static void Main(string[] args)
        {
            // vytvoření databázového kontextu
            DbPublicationEntities context = new DbPublicationEntities();

            // vytvoření objektů pro správu dat společných pro všechny typy publikací
            PublicationModel publicationModel = new PublicationModel(context);
            AuthorModel      authorModel      = new AuthorModel(context);
            AttachmentModel  attachmentModel  = new AttachmentModel(context);

            // vytvoření seznamu typů publikací s přidruženými dialogy a objekty pro správu dat
            List <PublicationType> publicationTypes = initializePublicationTypes(context);

            // vytvoření instance hlavního menu, která je propojena s vytvořenými objekty datové vrstvy
            MainMenu mainMenu = new MainMenu(publicationTypes, publicationModel, authorModel, attachmentModel);

            // spuštění načítání příkazů
            mainMenu.Start();
        }
 public IHttpActionResult EditPublication([FromBody] PublicationModel publication)
 {
     if (ModelState.IsValid)
     {
         var publicationDTO = new PublicationDTO
         {
             Header = publication.Header,
             Author = new UserDTO {
                 Email = User.Identity.Name
             },
             Content      = publication.Content,
             UsersWhoLike = null,
             Id           = publication.Id
         };
         _publicationService.Edit(publicationDTO);
         return(Ok("Publication was edite"));
     }
     return(BadRequest(" model is not valid"));
 }
Exemplo n.º 25
0
        private async void UpdateMainVideoAirtableBtn_Click(object sender, EventArgs e)
        {
            if (!CheckSelectedRow())
            {
                return;
            }
            foreach (DataGridViewRow row in VideoDGV.SelectedRows)
            {
                PublicationModel model = row.DataBoundItem as PublicationModel;

                if (await _dataService.UpdateMainVideoRecord(model.Id, model.MainVideo))
                {
                    MessageBox.Show("Airtable a été mis à jour");
                }
                else
                {
                    MessageBox.Show("Problème pendant la mise à jour de Airtable");
                }
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Provede inicializaci datových objektů a grafických komponent.
        /// </summary>
        /// <param name="publicationModel">správce publikací</param>
        /// <param name="authorModel">správce autorů</param>
        /// <param name="attachmentModel">správce příloh</param>
        /// <param name="publicationTypes">seznam podporovaných typů publikací</param>
        public MainWindow(PublicationModel publicationModel, AuthorModel authorModel,
                          AttachmentModel attachmentModel, List <PublicationType> publicationTypes)
        {
            this.publicationModel = publicationModel;
            this.authorModel      = authorModel;
            this.attachmentModel  = attachmentModel;
            this.publicationTypes = publicationTypes;

            InitializeComponent();

            /*
             *  načtení aktuálního nefiltrovaného seznamu publikací, aktuálního seznamu autorů,
             *  seznamu použitých letopočtů a seznamu podporovaných typů publikací (seznamy autorů,
             *  letopočtů a typů slouží k nastavení filtrů výpisu publikací)
             */
            refreshPublications();
            refreshAuthors();
            refreshYears();
            typeFilterListView.ItemsSource = publicationTypes;
        }
Exemplo n.º 27
0
        public ActionResult Like(int id, string NameId)
        {
            PublicationModel publicationmodel = followPeersDB.PublicationModels.Find(id);

            publicationmodel.Likes = publicationmodel.Likes + 1;
            string      name = Membership.GetUser().UserName;
            int         userID;
            UserProfile user = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name);

            userID = user.UserProfileId;
            AchievementLike achievement = new AchievementLike();

            achievement.Type          = 6;
            achievement.UserProfileId = userID;
            achievement.AchievementId = id;
            achievement.UserProfile   = user;
            user.AchievementLikes.Add(achievement);
            followPeersDB.SaveChanges();
            return(Json(id));
        }
Exemplo n.º 28
0
        public async Task <IActionResult> Create(PublicationModel model)
        {
            if (ModelState.IsValid)
            {
                var currentUser = await _userManager.GetUserAsync(HttpContext.User);

                var publication = new Publication
                {
                    Id         = Guid.NewGuid(),
                    AuthorId   = currentUser.Id,
                    PublicDate = DateTime.Now,
                    Header     = model.Header,
                    ImagePath  = model.ImagePath,
                    Tags       = model.Tags,
                };
                await _reposiroty.SaveOrUpdateAsync(publication);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Exemplo n.º 29
0
        /// <summary>
        /// Inicializuje menu správy seznamu příloh publikace.
        /// </summary>
        /// <param name="publicationModel">správce publikací</param>
        /// <param name="attachmentModel">správce příloh</param>
        public PublicationAttachmentMenu(PublicationModel publicationModel, AttachmentModel attachmentModel, int publicationId)
        {
            this.publicationModel = publicationModel;
            this.attachmentModel  = attachmentModel;
            this.publicationId    = publicationId;

            MenuLabel = "Menu správy příloh publikace č. " + publicationId;
            InitializeMenuItems(new Dictionary <ConsoleKey, MenuItem>()
            {
                { ConsoleKey.C, new MenuItem()
                  {
                      Name = "Create", Description = "Přidá nový soubor se zadanou cestou do seznamu příloh publikace.", UIMethod = CreateAttachment
                  } },
                { ConsoleKey.D, new MenuItem()
                  {
                      Name = "Delete", Description = "Odebere existující soubor se zadaným ID ze seznamu příloh publikace.", UIMethod = DeleteAttachment
                  } },
            });

            GetAttachmentList();
        }
Exemplo n.º 30
0
 public static Publication Map(PublicationModel objModel)
 {
     return(new Publication
     {
         Id = objModel.Id,
         GroupId = objModel.GroupId,
         ProjectId = objModel.ProjectId,
         Title = objModel.Title,
         CategoryId = objModel.CategoryId,
         DisciplineId = objModel.DisciplineId,
         Resume = objModel.Resume,
         Description = objModel.Description,
         DeletedBy = objModel.DeletedBy,
         DisabledBy = objModel.DisabledBy,
         DeletedDate = objModel.DeletedDate,
         CreatedDate = objModel.CreatedDate,
         ModifiedDate = objModel.ModifiedDate,
         CreatedBy = objModel.CreatedBy,
         Status = objModel.Status
     });
 }