Exemple #1
0
        public ActionResult EmailAddress_Destroy([DataSourceRequest] DataSourceRequest request, string pid, EmailAddresses _objEmailAddresses)
        {
            if (ModelState.IsValid)
            {
                _objEmailAddresses.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _objEmailAddresses.UpdatedDate = DateTime.Now;
                if (_objEmailAddresses.IsPrimary == true)
                {
                    ModelState.AddModelError(lr.ErrorServerError, lr.PrimaryContents);
                }
                else
                {
                    var result = _objPersonContactBAL.PersonEmailAddress_DeleteBAL(_objEmailAddresses, Convert.ToInt64(pid));
                    if (!result)
                    {
                        ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                    }
                }
            }
            var resultData = new[] { _objEmailAddresses };

            return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState)));
        }