Пример #1
0
 public ActionResult Delete(string username)
 {
     try
     {
         _storesService.Delete(_ => _.Username == username);
         _storesService.SaveChanges();
         return(StatusCode(204));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Пример #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here
                    await Service.Delete <Store>(id);

                    return(RedirectToAction("Index"));
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }