Esempio n. 1
0
        public ActionResult Links_Update([DataSourceRequest] DataSourceRequest request, long oid, int type, Links _objLinks)
        {
            if (ModelState.IsValid)
            {
                _objLinks.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _objLinks.UpdatedDate = DateTime.Now;
                _objLinks.Description = "";
                if (type == 1)
                {
                    if (_objPersonContactBAL.PersonLinks_DuplicationCheckBAL(_objLinks, Convert.ToInt64(oid)) > 0)
                    {
                        ModelState.AddModelError(lr.PersonContactLink, lr.PersonContactLinkDuplicationCheck);
                    }
                    else
                    {
                        var result = _objPersonContactBAL.PersonLinks_UpdateBAL(_objLinks);
                        if (result == -1)
                        {
                            ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                        }
                    }
                }
                else
                {
                    if (_objIOrganizationBAL.OrganizationLinks_DuplicationCheckBAL(_objLinks, Convert.ToInt64(oid)) > 0)
                    {
                        ModelState.AddModelError(lr.PersonContactLink, lr.OrganizationContactLinkDuplicationCheck);
                    }
                    else
                    {
                        var result = _objIOrganizationBAL.OrganizationLinks_UpdateBAL(_objLinks);
                        if (result == -1)
                        {
                            ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                        }
                    }
                }
            }
            var resultData = new[] { _objLinks };

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