public async Task <object> Delete(string UID)
        {
            bool isValid = await _supplierService.DeleteSupplier(UID);

            _notification.SetNotificationMessage(isValid, Title, UID);

            return(_notification);
        }
Example #2
0
        public IHttpActionResult Delete(int id)
        {
            if (suppliersService.DeleteSupplier(id))
            {
                suppliersService.SaveChanges();

                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
        public ActionResult DeleteSupplier([Bind(Include = "Id")] DeleteSupplierBm deleteSupplierBm)
        {
            HttpCookie cookie = this.Request.Cookies.Get("sessionId");

            if (cookie == null || !AuthenticationManager.IsAuthenticated(cookie.Value))
            {
                return(this.RedirectToAction("Login", "Users"));
            }

            if (!this.ModelState.IsValid)
            {
                DeleteSupplierViewModel supplierBind = this.service.GetSupplierToDelete(deleteSupplierBm.Id);
                return(this.View(supplierBind));
            }
            User user = AuthenticationManager.GetAuthenticatedUser(cookie.Value);

            service.DeleteSupplier(deleteSupplierBm, user.Id);
            return(this.RedirectToAction("viewSuppliers", "Supplier"));
        }