Exemplo n.º 1
0
        public async Task <ActionResult> DrugListAsync()
        {
            ViewBag.message = TempData["redirect"];
            var items = await DocumentDBRespository <Drugs> .GetItemsAsync();

            return(View(items));
        }
        public async Task <ActionResult> CreateAsync([Bind("drugname,description,price,stock")] Drugs drug, IFormFile file)
        {
            int count = 0;

            if (ModelState.IsValid)
            {
                var imageUrl = UploadBlob(file);
                drug.imageURL = imageUrl.ToString();
                var items = await DocumentDBRespository <Drugs> .GetItemsAsync();

                foreach (var item in items)
                {
                    count++;
                }
                int    convert   = count + 1;
                string convertid = convert.ToString();
                drug.Id = convertid;
                await DocumentDBRespository <Drugs> .CreateItemAsync(drug);

                return(RedirectToAction("Index"));
            }
            return(View(drug));
        }
        public async Task <ActionResult> IndexAsync()
        {
            var items = await DocumentDBRespository <TicketHistory> .GetItemsAsync();

            return(View(items));
        }