Exemplo n.º 1
0
        public async Task <IActionResult> Edit(ProfSkill model)
        {
            var header = this.Request.Headers["sec-fetch-site"];

            if (header == "none")
            {
                return(RedirectToAction("Index", "Advertisement"));
            }
            if (ModelState.IsValid)
            {
                ProfSkill entity = db.ProfSkills.FirstOrDefault(e => e.Id == model.Id);
                entity.Name    = model.Name;
                entity.Percent = model.Percent;
                db.Update <ProfSkill>(entity);
                await db.SaveChangesAsync();

                toastNotification.AddSuccessToastMessage("Professional Skill Updated !", new NotyOptions
                {
                    Theme   = "metroui",
                    Timeout = 1500,
                    Layout  = "topCenter"
                });
            }
            return(PartialView("_Edit", model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ProfID,SkillID")] ProfSkill profSkill)
        {
            if (id != profSkill.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profSkill);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfSkillExists(profSkill.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SkillID"] = new SelectList(_context.Skills, "ID", "Title", profSkill.SkillID);
            ViewData["ProfID"]  = new SelectList(_context.Professors, "ID", "Evidence", profSkill.ProfID);
            return(View(profSkill));
        }
Exemplo n.º 3
0
        public IActionResult Create()
        {
            var header = this.Request.Headers["sec-fetch-site"];

            if (header == "none")
            {
                return(RedirectToAction("Index", "Advertisement"));
            }
            ProfSkill model = new ProfSkill();

            return(PartialView("_Create", model));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("ID,ProfID,SkillID")] ProfSkill profSkill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(profSkill);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SkillID"] = new SelectList(_context.Skills, "ID", "Title", profSkill.SkillID);
            ViewData["ProfID"]  = new SelectList(_context.Professors, "ID", "Evidence", profSkill.ProfID);
            return(View(profSkill));
        }
Exemplo n.º 5
0
        public IActionResult Edit(int id)
        {
            var header = this.Request.Headers["sec-fetch-site"];

            if (header == "none")
            {
                return(RedirectToAction("Index", "Advertisement"));
            }
            ProfSkill model = db.ProfSkills.FirstOrDefault(e => e.Id == id);

            if (model == null)
            {
                return(NotFound());
            }
            return(PartialView("_Edit", model));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> DeleteOnPost(int id)
        {
            ProfSkill education = db.ProfSkills.FirstOrDefault(e => e.Id == id);

            if (education == null)
            {
                return(NotFound());
            }
            db.Remove <ProfSkill>(education);
            await db.SaveChangesAsync();

            toastNotification.AddSuccessToastMessage("Professional Skill Deleted !", new NotyOptions
            {
                Theme   = "metroui",
                Timeout = 1500,
                Layout  = "topCenter"
            });
            return(RedirectToAction("EditResume", "Profile"));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Create(ProfSkill model)
        {
            if (ModelState.IsValid)
            {
                User currentUser = await signInManager.UserManager.GetUserAsync(this.User);

                model.UserId = currentUser.Id;
                await db.AddAsync <ProfSkill>(model);

                await db.SaveChangesAsync();

                toastNotification.AddSuccessToastMessage("Professional Skill Added !", new NotyOptions
                {
                    Theme   = "metroui",
                    Timeout = 1500,
                    Layout  = "topCenter"
                });
            }
            return(PartialView("_Create", model));
        }