コード例 #1
0
        public IActionResult Create(Director payload)
        {
            if (!UserIsInRole(UserTypeEnum.Admin))
            {
                return(Unauthorized("You are not in role to permit this action"));
            }

            _service.Insert(payload);
            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> Insert(DirectorInsertDto directorInsertDto)
        {
            directorInsertDto.CreatedByUserName  = "******";
            directorInsertDto.ModifiedByUserName = "******";
            directorInsertDto.PicturePath        = await ImageExtensions.ImageUpload(
                directorInsertDto.FirstName + directorInsertDto.LastName,
                "directors", directorInsertDto.Picture, _env);

            var insertedDirector = await _directorService.Insert(directorInsertDto);

            if (insertedDirector.ResultStatus == ResultStatus.Success)
            {
                return(Json(0));
            }
            return(Json(1));
        }