Пример #1
0
        public JsonResult delete(int id)
        {
            var skill = _skillService.GetById(id);

            _skillService.Delete(skill);
            return(Json("Başarıyla silindi"));
        }
        /// <summary>
        /// To delete a skill
        /// </summary>
        /// <param name="id">SkillId</param>
        public void Delete(string id)
        {
            ISkillService <Skill> jobSeekerService = ServiceFactory.GetSkill();
            var jobSeeker = jobSeekerService.GetById(id);

            jobSeekerService.Delete(jobSeeker);
        }
Пример #3
0
 public IActionResult Delete(int id)
 {
     return(ApiAction(() =>
     {
         _skillService.Delete(id);
         return Accepted();
     }));
 }
Пример #4
0
        public ActionResult Delete(int id)
        {
            var entity = _skillService.GetById(id);

            _skillService.Delete(entity);

            return(NoContent());
        }
Пример #5
0
        public ActionResult DeleteConfirmed(long id)
        {
            skill skill = _skillService.GetById((int)id);

            _skillService.Delete(skill);
            _skillService.commit();
            return(RedirectToAction("Index"));
        }
Пример #6
0
        public HttpResponseMessage Delete(int id)
        {
            _skillService.Delete(id);

            SuccessResponse response = new SuccessResponse();

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Пример #7
0
        public async Task <IActionResult> Delete(int skillID)
        {
            var result = await _skillService.Delete(skillID);

            if (!result.IsSuccessed)
            {
                return(BadRequest(result));
            }
            return(Ok(result));
        }
Пример #8
0
 public ActionResult <bool> Delete(long id)
 {
     try
     {
         _skillService.Delete(id);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(UnprocessableEntity(ex));
     }
 }
Пример #9
0
 public ActionResult Delete(SkillViewModel model)
 {
     try
     {
         service.Delete(model);
         service.Save();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Пример #10
0
        public async Task <bool> DeleteSkill(int skillId)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                if ((await skillService.GetAsync(skillId, false)) == null)
                {
                    return(false);
                }
                skillService.Delete(skillId);
                await uow.Commit();

                return(true);
            }
        }
        public async Task <ActionResult> DeleteSkill(int id, string returnUrl)
        {
            try
            {
                await _skillService.Delete(id);

                string temp = string.IsNullOrWhiteSpace(returnUrl) ? Url.Action("Skills") : returnUrl;
                return(Redirect(temp));
            }
            catch (Exception ex)
            {
                return(HttpNotFound(ex.Message));
            }
            //   return RedirectToAction("Skills", new {ex.Message}); // todo  returnUrl
        }
 public IHttpActionResult DeleteSkill(int skillId)
 {
     try
     {
         _skillService.Delete(skillId);
     }
     catch (ValidationException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
     return(Ok(new { Message = "Skill deletae succesfully" }));
 }
Пример #13
0
        public IHttpActionResult Delete(int id, SkillDTO employee)
        {
            if (id != employee.Id)
            {
                return(BadRequest());
            }

            try
            {
                skillService.Delete(Mapper.Map <SkillDTO, Skill>(employee));
            }
            catch (Exception ex)
            {
                return(NotFound());
            }

            return(Ok());
        }
Пример #14
0
        public IActionResult Delete(long id)
        {
            if (id == 0)
            {
                _logger.LogInfo("id paaram is 0");
                return(BadRequest());
            }

            try
            {
                _skillService.Delete(id);
                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest());
            }
        }
Пример #15
0
        public ActionResult DeleteSkill(int id, int SkillId)
        {
            Candidate c = candidateService.GetById(id);

            for (int i = 0; i < c.Skills.Count; i++)
            {
                if (c.Skills.ElementAt(i).SkillId == SkillId)
                {
                    c.Skills.Remove(c.Skills.ElementAt(i));
                    break;
                }
            }
            candidateService.Update(c);
            candidateService.Commit();
            Skill s = skillService.GetById(SkillId);

            skillService.Delete(s);
            skillService.Commit();
            return(RedirectToAction("Details", new { id }));
        }
Пример #16
0
 public ActionResult Delete(SkillViewModel skillView, FormCollection collection)
 {
     try
     {
         if (skillView == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         else
         {
             var deleteResult = _skillService.Delete(skillView.SkillName);
             //Notification Message is stored in tempdata
             TempData["message"] = "Successfully deleted skill record";
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception)
     {
         return(View());
     }
 }
        public IHttpActionResult Delete(int skillId)
        {
            var currentUser = ApplicationContext.Current.CurrentUser;

            //current user must be admin to delete this skill
            if (!currentUser.IsAdministrator())
            {
                return(Unauthorized());
            }

            var skill = _skillService.Get(skillId);

            if (skill == null)
            {
                return(NotFound());
            }

            _userSkillService.Delete(x => x.SkillId == skillId);
            //so we can safely delete this
            _skillService.Delete(skill);
            return(RespondSuccess());
        }
Пример #18
0
        public IHttpActionResult Delete(int skillId)
        {
            var currentUser = _workContext.CurrentCustomer;

            //current user must be admin to delete this skill
            if (!currentUser.IsAdmin())
            {
                return(Unauthorized());
            }

            var skill = _skillService.GetById(skillId);

            if (skill == null)
            {
                return(NotFound());
            }

            _userSkillService.Delete(x => x.SkillId == skillId);
            //so we can safely delete this
            _skillService.Delete(skill);
            return(Response(new { Success = true }));
        }
Пример #19
0
 public IActionResult Delete(Guid SkillID)
 {
     Service.Delete(SkillID);
     return(Ok(true));
 }
Пример #20
0
 public IActionResult Delete(int id)
 {
     _skillService.Delete(id);
     return(StatusCode(StatusCodes.Status204NoContent));
 }
 public string Delete(int id)
 {
     service.Delete(id);
     return("Deleted successfully");
 }
Пример #22
0
 public ActionResult OnPostDelete(int modelId)
 {
     _skillService.Delete(modelId);
     return(CustomRedirect(SitePages.MajorEditorSkillsIndex));
 }
Пример #23
0
 public ActionResult DeleteConfirmed(int id)
 {
     _skillService.Delete(id);
     return(RedirectToAction("Index"));
 }
 public BaseResponse <bool> Delete(Guid id)
 {
     return(_skillService.Delete(id));
 }
Пример #25
0
 // GET: Skill/Delete/5
 public ActionResult Delete(int id)
 {
     skillService.Delete(s => s.skillId == id);
     skillService.Commit();
     return(RedirectToAction("Index"));
 }
Пример #26
0
        public ActionResult Edit(ProjectViewModel projectViewModel, string tags, string btn)
        {
            if (btn != null && btn == "Next Step")
            {
                using (var client = new HttpClient())
                {
                    String clientId    = Request.Form["CLIENT"].ToString();
                    string projectType = Request.Form["TypeProject"].ToString();
                    projectViewModel.projectType = projectType;
                    person person = clientService.GetById(Int32.Parse(clientId));
                    projectViewModel.clientId = person;
                    client.BaseAddress        = new Uri("http://127.0.0.1:18080/");
                    var putTask =
                        client.PutAsJsonAsync <ProjectViewModel>("Map-JavaEE-web/MAP/projects", projectViewModel);
                    putTask.Wait();
                    var result = putTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("Index"));
                    }
                }
                FillEnumDropDownList();
                ViewBag.CLIENT = new SelectList(db.people, "id", "nameSociety", projectViewModel.clientId.id);

                //list value of tags from view
                List <string> listTagsFromView = tags.Split(',').ToList();
                //list of skills of project from db
                List <skill> listSkillsFromDb = new List <skill>();
                //List qui sera envoyer à la vue EditSkills avec liste des skills ajouter
                List <SkillViewModel> listSkillViewModel = new List <SkillViewModel>();

                skill        skillDomain  = new skill();
                projectskill projectSkill = new projectskill();
                var          res          = db.projectskills
                                            .Join(db.skills, ps => ps.idSkill, s => s.IdSkill, (ps, s) => new { ps, s })
                                            .Join(db.projects, ppc => ppc.ps.idProject, p => p.id, (ppc, p) => new { ppc, p })
                                            .Where(m => m.p.id.Equals(projectViewModel.id))
                                            .Select(m => new
                {
                    id      = m.ppc.s.IdSkill,
                    name    = m.ppc.s.NameSkill,
                    percent = m.ppc.ps.percentage
                }).ToList();

                foreach (var item in res)
                {
                    listSkillsFromDb.Add(new skill(item.id, item.name));
                }

                List <string> nameSkills = listSkillsFromDb.Select(o => o.NameSkill).ToList();

                foreach (var tag in listTagsFromView)
                {
                    if (!(nameSkills.Contains(tag)))
                    {
                        skillDomain.NameSkill = tag;
                        skillService.Add(skillDomain);
                        skillService.Commit();
                        listSkillViewModel.Add(new SkillViewModel(skillDomain.IdSkill, skillDomain.NameSkill));
                    }
                }
                foreach (var skill in listSkillsFromDb)
                {
                    if (!(listTagsFromView.Contains(skill.NameSkill)))
                    {
                        projectSkill = projectSkillService.GetMany().Where(a => a.idProject == projectViewModel.id)
                                       .Where(b => b.idSkill == skill.IdSkill).FirstOrDefault();
                        projectSkillService.Delete(projectSkill);

                        projectSkillService.Commit();

                        skillDomain = skillService.GetById(skill.IdSkill);
                        skillService.Delete(skillDomain);

                        skillService.Commit();
                    }
                    else
                    {
                        listSkillViewModel.Add(new SkillViewModel(skill.IdSkill, skill.NameSkill));
                    }
                }

                return(RedirectToAction("EditSkills", new { serializedModel = JsonConvert.SerializeObject(listSkillViewModel), id = projectViewModel.id }));
            }
            return(View(projectViewModel));
        }