Ejemplo n.º 1
0
        public async Task <IActionResult> Insert(CastInsertDto castInsertDto)
        {
            castInsertDto.CreatedByUserName  = "******";
            castInsertDto.ModifiedByUserName = "******";
            castInsertDto.PicturePath        = await ImageExtensions.ImageUpload(
                castInsertDto.FirstName + castInsertDto.LastName,
                "casts", castInsertDto.Picture, _env);

            var insertedCast = await _castService.Insert(castInsertDto);

            if (insertedCast.ResultStatus == ResultStatus.Success)
            {
                return(Json(0));
            }
            return(Json(1));
        }
Ejemplo n.º 2
0
        public async Task <IDataResult <Cast> > Insert(CastInsertDto castInsertDto)
        {
            var cast = _mapper.Map <Cast>(castInsertDto);

            cast.ModifiedDate = cast.CreatedDate;

            var insertedCast = await _unitOfWork.Casts.InsertAsync(cast);

            await _unitOfWork.SaveAsync();

            if (insertedCast != null)
            {
                return(new DataResult <Cast>(ResultStatus.Success, cast));
            }

            return(new DataResult <Cast>(ResultStatus.Error, cast));
        }