コード例 #1
0
        //post photo api
        //should return rp
        public ActionResult <PhotoAddRp> AddPhoto(PhotoAddRt rt)
        {
            var photo = _mapper.Map <Photo>(rt);

            _photoRepository.AddPhoto(photo);
            _photoRepository.SaveChanges();

            return(Ok(_mapper.Map <PhotoAddRp>(photo)));
        }
コード例 #2
0
        public ActionResult <char> UploadPhoto([FromForm] PhotoAddRt form)
        {
            //save photo
            var photo = _mapper.Map <Photo>(form);

            //hardcode
            photo.ByUserId = 1;
            _photoRepository.AddPhoto(photo);
            _photoRepository.SaveChanges();

            return('a');
        }
コード例 #3
0
 public void AddPhotoByUser(PhotoAddRt photoForm)
 {
     Console.Write(photoForm);
     _context.Add(photoForm);
 }