コード例 #1
0
        // GET: Stores/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            try
            {
                var response = await StoresServices.GetStoreAsync((int)id);

                if (response.success)
                {
                    return(View(response.store));
                }
                else
                {
                    ViewBag.ErrorMsg = "Ocurrió un error al tratar de obtener la tienda.";
                    return(View("Error"));
                }
            }
            catch (Exception)
            {
                ViewBag.ErrorMsg = "Ocurrió un error al tratar de editar la tienda.";
                return(View("Error"));
            }
        }
コード例 #2
0
        // GET: Stores/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var response = await StoresServices.GetStoreAsync(id);

            if (response.success)
            {
                return(View(response.store));
            }
            else
            {
                ViewBag.ErrorMsg = "Ocurrió un error al tratar de obtener la tienda.";
                return(View("Error"));
            }
        }
コード例 #3
0
        // GET: Stores/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var response = await StoresServices.GetStoreAsync((int)id);

            if (response.success)
            {
                return(View(response.store));
            }
            else
            {
                return(View("Error"));
            }
        }