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)); }
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); } }
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 })); }
[System.Web.Mvc.HttpPost] public void Add(Skill skill) { SkillRepository.Add(skill); }
public void Add(Skill skill) { _skillRepository.Add(skill); _skillListStale = true; }