Example #1
0
        public bool Delete(string[] pArgs)
        {
            AddressModel model = new AddressModel();

            model.Id = int.Parse(pArgs[0]);

            return(addressRepo.Delete(model));
        }
Example #2
0
        public void Delete(int id)
        {
            var model = _repository.GetById(id).Result;

            _repository.Delete(id, model);
            if (model != null)
            {
                _address.Delete(model.Addresses);
            }
        }
        public ActionResult Delete(int id)
        {
            var addressFromDb = _addressService.Get(id);

            if (addressFromDb == null)
            {
                return(NotFound());
            }
            _addressService.Delete(addressFromDb);
            _addressService.SaveChanges();
            return(NoContent());
        }
    protected void AddressGrid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (!CanChangeAddress())
        {
            return;
        }

        if (e.CommandName.Equals("Edit"))
        {
            int    rowIndex = Convert.ToInt32(e.CommandArgument);
            string Id       = AddressGrid.DataKeys[rowIndex].Value.ToString();
            if (DialogService != null)
            {
                DialogService.SetSpecs(200, 200, 318, 600, "AddEditAddress", "", true);
                DialogService.EntityType = typeof(IAddress);
                DialogService.EntityID   = Id;
                DialogService.ShowDialog();
            }
            return;
        }
        if (e.CommandName.Equals("Delete"))
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            string   Id      = AddressGrid.DataKeys[rowIndex].Value.ToString();
            IAddress address = EntityFactory.GetById <IAddress>(Id);
            if ((address.IsPrimary == true) || (address.IsMailing == true))
            {
                if (DialogService != null)
                {
                    string msg = GetLocalResourceObject("DeleteAddressMessage").ToString();
                    DialogService.ShowMessage(msg);
                }
            }
            else
            {
                address.Delete();
                LoadGrid();
            }
        }
    }
Example #5
0
 public static bool Delete(string addressList, string userName)
 {
     return(DataValidator.IsValidId(addressList) && dal.Delete(addressList, userName));
 }