Ejemplo n.º 1
0
        public async Task <ActionResult> Delete(int technicalStaffId)
        {
            var competitionId = await _commonTechnicalStaffService.GetCompetitionId(technicalStaffId);

            var canEdit = await _competitionService
                          .CanDeleteCommonTechncialStaff(competitionId, Convert.ToInt32(User.Identity.Name));

            if (!canEdit)
            {
                ModelState.AddModelError("", "امکان حذف کادر اجرایی وجود ندارد.");
                return(this.JsonValidationErrors());
            }

            _commonTechnicalStaffService.Delete(technicalStaffId);

            await _dbContext.SaveChangesAsync();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }