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

            return(CreatedAtAction(nameof(GetPhonesAPI), new { id = value.PhoneID }, value));
        }
Ejemplo 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"));
        }
Ejemplo 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"));
        }