Beispiel #1
0
        public IActionResult Insert()
        {
            TempData["active"] = "yetenek";
            var model = new SkillAddDto();

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> Create()
        {
            TempData["active"] = "skill";
            SkillAddDto skillAddDto = new SkillAddDto();

            skillAddDto.CategoryList = new SelectList(await _categoryService.GetListAsync(), "Id", "Name");
            return(View(skillAddDto));
        }
Beispiel #3
0
        public async Task <IActionResult> Add(SkillAddDto skillAddDto)
        {
            if (ModelState.IsValid)
            {
                await _skillService.Add(skillAddDto, "Hasan Erdal");

                return(RedirectToAction("Index"));
            }
            return(View());
        }
 public IActionResult Add(SkillAddDto model)
 {
     TempData["active"] = "yetenek";
     if (ModelState.IsValid)
     {
         _genericSkillService.Insert(_mapper.Map <Skill>(model));
         TempData["message"] = "Ekleme işleminiz başarılı";
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Beispiel #5
0
 public IActionResult Insert(SkillAddDto model)
 {
     if (ModelState.IsValid)
     {
         _genericService.Insert(new Skill {
             Description = model.Description
         });
         TempData["message"] = "İşlem başarıyla tamamlandı.";
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Beispiel #6
0
        public async Task <IActionResult> CreateSkill(
            [FromBody] SkillAddDto model,
            CancellationToken ct)
        {
            var entity = new SkillEntity
            {
                Id   = Guid.NewGuid(),
                Name = model.Name,
                YearsOfExperience = model.YearsOfExperience,
                Level             = model.Level
            };
            await _repository.Create(entity, ct);

            return(Ok());
        }
Beispiel #7
0
        public async Task <IDataResult <SkillDto> > Add(SkillAddDto skillAddDto, string createdByName)
        {
            var skill = _mapper.Map <Skill>(skillAddDto);

            skill.CreatedByName  = createdByName;
            skill.ModifiedByName = createdByName;
            skill.ModifiedTime   = DateTime.Now;
            var addedSkill = await _unitOfWork.Skill.AddAsync(skill);

            await _unitOfWork.SaveAsync();

            return(new DataResult <SkillDto>(ResultStatus.Success, $"{addedSkill.Title} isimli yetenek başarılı bir şekilde kayıt edilmiştir.", new SkillDto
            {
                Skill = addedSkill,
                Message = $"{addedSkill.Title} isimli yetenek başarılı bir şekilde kayıt edilmiştir.",
                ResultStatus = ResultStatus.Success
            }));
        }
Beispiel #8
0
        public async Task <IActionResult> Create(SkillAddDto skillAddDto)
        {
            if (ModelState.IsValid)
            {
                await _skillService.InsertAsync(new Skill
                {
                    IsDraft       = skillAddDto.IsDraft,
                    LevelPercent  = skillAddDto.LevelPercent,
                    SubCategoryId = skillAddDto.SubCategoryId,
                    Text          = skillAddDto.Text,
                    Title         = skillAddDto.Title,
                });

                return(RedirectToAction("Index"));
            }

            skillAddDto.CategoryList = new SelectList(await _categoryService.GetListAsync(), "Id", "Name");
            return(View(skillAddDto));
        }