public async Task <IActionResult> Update(ScenaristUpdateDto scenaristUpdateDto)
        {
            bool isNewPicUploaded = false;
            var  oldUserPic       = scenaristUpdateDto.PicturePath;

            if (scenaristUpdateDto.Picture != null)
            {
                scenaristUpdateDto.PicturePath = await ImageExtensions.ImageUpload(
                    scenaristUpdateDto.FirstName + scenaristUpdateDto.LastName,
                    "scenarists", scenaristUpdateDto.Picture, _env);

                isNewPicUploaded = true;
            }
            scenaristUpdateDto.ModifiedByUserName = "******";

            var updatedScenarist = await _scenaristService.Update(scenaristUpdateDto);

            if (updatedScenarist.ResultStatus == ResultStatus.Success)
            {
                if (isNewPicUploaded)
                {
                    ImageExtensions.ImageDelete(oldUserPic, "scenarists", _env);
                }
                return(Json(0));
            }

            return(Json(1));
        }
        public async Task <IDataResult <Scenarist> > Update(ScenaristUpdateDto scenaristUpdateDto)
        {
            var oldScenarist = await _unitOfWork.Scenarists.GetAsync(s => s.Id == scenaristUpdateDto.Id);

            var scenarist = _mapper.Map <ScenaristUpdateDto, Scenarist>(scenaristUpdateDto, oldScenarist);

            var updatedScenarist = await _unitOfWork.Scenarists.UpdateAsync(scenarist);

            await _unitOfWork.SaveAsync();

            if (updatedScenarist != null)
            {
                return(new DataResult <Scenarist>(ResultStatus.Success, updatedScenarist));
            }
            return(new DataResult <Scenarist>(ResultStatus.Error, null));
        }