Example #1
0
        public async Task <IActionResult> PutIndividImages(int id, IndividImages individImages)
        {
            if (id != individImages.Idindivid)
            {
                return(BadRequest());
            }

            _context.Entry(individImages).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IndividImagesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            string anchor = Intent.GetStringExtra("anchor");

            this.SetContentView(Resource.Layout.individ_info);

            DataBase db = new DataBase();

            _ = db.CreateDataBaseAsync();
            HttpClient client = new HttpClient();

            Main    main    = GetMains(anchor, db, client);
            Individ individ = GetIndivid(main.Idindivid, db, client);

            animal = GetAnimal(individ.Idanimal, db, client);
            IndividImages individImages = GetImages(individ.Id, db, client);

            IndividInfo        individInfo = new IndividInfo(individ, individImages);
            IndividInfoAdapter adapter     = new IndividInfoAdapter(this, new List <IndividInfo>()
            {
                individInfo
            });

            ListView.Adapter = adapter;

            Button backButton = this.FindViewById <Button>(Resource.Id.BackButton);

            backButton.Click += this.OnBackClick;
            Button viewMoreButton = this.FindViewById <Button>(Resource.Id.ViewButton);

            viewMoreButton.Click += this.OnViewClick;
        }
        public async Task <IActionResult> Create([Bind("Idindivid,Image1,Image2,Image3,Image4,Image5,Image6,Image7,Image8,Image9,Image10,Description")] IndividImages individImages)
        {
            if (ModelState.IsValid)
            {
                _context.Add(individImages);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(individImages));
        }
Example #4
0
        public IndividImages GetImages(int id, DataBase db, HttpClient client)
        {
            IndividImages images = (IndividImages)db.SelectQueryTable(id, Constants.Constants.selectImagesQuery);

            if (images == null)
            {
                System.Threading.Tasks.Task <string> result = client.GetStringAsync(Constants.Constants.imagesUri + id);
                images = JsonConvert.DeserializeObject <IndividImages>(result.Result);
                db.InsertIntoTable(images);
            }

            return(images);
        }
Example #5
0
        public async Task <ActionResult <IndividImages> > PostIndividImages(IndividImages individImages)
        {
            _context.IndividImages.Add(individImages);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (IndividImagesExists(individImages.Idindivid))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetIndividImages", new { id = individImages.Idindivid }, individImages));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Idindivid,Image1,Image2,Image3,Image4,Image5,Image6,Image7,Image8,Image9,Image10,Description")] IndividImages individImages)
        {
            BlobUpload blob = new BlobUpload();

            if (individImages.Image1 != null)
            {
                individImages.Image1 = await blob.uploadToBlobAsync(individImages.Image1);
            }
            if (individImages.Image2 != null)
            {
                individImages.Image2 = await blob.uploadToBlobAsync(individImages.Image2);
            }
            if (individImages.Image3 != null)
            {
                individImages.Image3 = await blob.uploadToBlobAsync(individImages.Image3);
            }
            if (individImages.Image4 != null)
            {
                individImages.Image4 = await blob.uploadToBlobAsync(individImages.Image4);
            }
            if (individImages.Image5 != null)
            {
                individImages.Image5 = await blob.uploadToBlobAsync(individImages.Image5);
            }
            if (individImages.Image6 != null)
            {
                individImages.Image6 = await blob.uploadToBlobAsync(individImages.Image6);
            }
            if (individImages.Image7 != null)
            {
                individImages.Image7 = await blob.uploadToBlobAsync(individImages.Image7);
            }
            if (individImages.Image8 != null)
            {
                individImages.Image8 = await blob.uploadToBlobAsync(individImages.Image8);
            }
            if (individImages.Image9 != null)
            {
                individImages.Image9 = await blob.uploadToBlobAsync(individImages.Image9);
            }
            if (individImages.Image10 != null)
            {
                individImages.Image10 = await blob.uploadToBlobAsync(individImages.Image10);
            }

            if (id != individImages.Idindivid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(individImages);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IndividImagesExists(individImages.Idindivid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(individImages));
        }
Example #7
0
 public IndividInfo(Individ individ, IndividImages images)
 {
     this.individ = individ;
     this.images  = images;
 }