Esempio n. 1
0
        public ActionResult <Phone> PostCreatePhone(Phone value)
        {
            _shopService.CreatePhonesAPI(value);
            _shopService.Commit();

            return(CreatedAtAction(nameof(GetPhonesAPI), new { id = value.PhoneID }, value));
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _cache.Remove("PhoneKey");

            await _shopservice.CreatePhone(Phone);

            await _shopservice.Commit();

            TempTest = Phone.PhoneName + " Blev oprettet";

            return(RedirectToPage("/Index"));
        }
Esempio n. 3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Phone = await _shopservice.FindPhone(id);

            if (Phone != null)
            {
                _shopservice.RemovePhone(Phone);
                await _shopservice.Commit();
            }

            return(RedirectToPage("./Index"));
        }