Exemplo n.º 1
0
        // It asks for a confirmation in deleting a selected product from the table
        public ActionResult Delete(int?idItem)
        {
            if (idItem != null)
            {
                try
                {
                    ISoldProductModel product = soldProductData.FindById((int)idItem);

                    if (product == null)
                    {
                        log.Error("Could't find a product in the Database - return null");
                        return(View("ErrorDeleteProduct"));
                    }
                    return(View(product));
                }

                catch (Exception ex)
                {
                    log.Error("Could't load product from Database", ex);
                    return(View("ErrorRetriveData"));
                }
            }
            else
            {
                log.Error("The sold product ID was null while trying to access");
                return(View("ErrorDeleteProduct"));
            }
        }
Exemplo n.º 2
0
 // GET: api/SoldProducts/5
 public ISoldProductModel Get(int id)
 {
     if (soldProductData.GetAll().Exists(x => x.ID == id))
     {
         return(soldProductData.FindById(id));
     }
     else
     {
         return(null);
     }
 }