Exemplo n.º 1
0
        public ActionResult AddSkill(AddSkillDto addSkillDto)
        {
            if (addSkillDto == null)
            {
                throw new ArgumentNullException(nameof(addSkillDto));
            }

            skillRepository.Add(addSkillDto.Username, addSkillDto.LevelId, addSkillDto.Summary);
            return(Ok());
        }
        public ActionResult Create([Bind(Include = "ID,SkillName,CreatedDate,UpdatedDate")] Skill skill)
        {
            if (ModelState.IsValid)
            {
                repo.Add(skill);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(skill));
        }
Exemplo n.º 3
0
        public IHttpActionResult NewSkill()
        {
            using (var context = new GameDatabaseContext())
            {

                var repo = new SkillRepository(context);
                var skill =
                    repo.Add(new SkillTemplate(SkillType.Elemental, SkillTargetType.Enemy, SkillActivationType.Immediate, 0,
                        0, "", 0, "New Skill"));

                return Ok(skill);
            }
        }
Exemplo n.º 4
0
        public ActionResult AddCompanySkill(int?skillId, int companyId, string skillName)
        {
            var company     = _companyRepository.GetCompanyWithDetails(companyId);
            var userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var userId      = User.GetClaimValue(UserIdClaim);

            if (string.IsNullOrEmpty(userId))
            {
                userId = User.Identity.GetUserId();
            }

            if (userManager.IsInRole(userId, CompanyRole) && company.CompanySkills.Count >= 3)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.MethodNotAllowed, ResourceString.Instance.SkillsLimitReached));
            }

            Skill skill = null;

            if (skillId == null)
            {
                skill = new Skill {
                    Name = skillName
                };
                _skillRepository.Add(skill);
            }
            else
            {
                skill = _skillRepository.Get(skillId.Value);
            }

            if (company == null || skill == null)
            {
                return(HttpNotFound());
            }

            _companySkillRepository.Add(new CompanySkill
            {
                SkillId   = skill.Id,
                CompanyId = companyId
            });
            return(Json(new { skillId = skill.Id }));
        }
Exemplo n.º 5
0
 [System.Web.Mvc.HttpPost] public void Add(Skill skill)
 {
     SkillRepository.Add(skill);
 }
Exemplo n.º 6
0
 public void Add(Skill skill)
 {
     _skillRepository.Add(skill);
     _skillListStale = true;
 }