Exemplo n.º 1
0
        public ActionResult CreateImage(string id)
        {
            IFormFile file   = Request.Form.Files[0];
            Stream    stream = file.OpenReadStream();

            byte[] b;
            using (BinaryReader br = new BinaryReader(stream))
            {
                b = br.ReadBytes((int)stream.Length);
            }
            string ImageId = coursesService.CreateImage(id, b);
            Course course  = coursesService.Get(id);

            course.Image = ImageId;
            coursesService.Update(course.Id, course);
            return(new JsonResult(course));
        }