Esempio n. 1
0
        public ActionResult PersonPhone_Destroy([DataSourceRequest] DataSourceRequest request, string pid, PhoneNumbers _objPhoneNumbers)
        {
            if (ModelState.IsValid)
            {
                _objPhoneNumbers.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _objPhoneNumbers.UpdatedDate = DateTime.Now;
                if (_objPhoneNumbers.IsPrimary == true)
                {
                    ModelState.AddModelError(lr.ErrorServerError, lr.PrimaryContents);
                }
                else
                {
                    var result = _objPersonContactBAL.PersonPhoneNumbers_DeleteBAL(_objPhoneNumbers, Convert.ToInt64(pid));
                    if (!result)
                    {
                        ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                    }
                }
            }
            var resultData = new[] { _objPhoneNumbers };

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