Пример #1
0
        public ActionResult SaveGridDomains(ProfileMembers pm, string newDomain)
        {
            if (ModelState.IsValid)
            {
                string allGroupIds = null;
                //OK, now update the posted-back data...
                foreach (var domain in pm.Profile.GroupingMetadatas)
                {
                    allGroupIds += domain.GroupId + ",";
                    _writer.Update(domain);
                }

                //insert any newly added domains
                if (!String.IsNullOrEmpty(newDomain))
                {
                    var groupingMetadata = _writer.NewGroupingMetadata(newDomain,
                                                                       pm.Profile.GroupingMetadatas.Last().Sequence + 1);

                    _dataAccess.UpdateProfileGroupIds(allGroupIds + groupingMetadata.GroupId.ToString(), pm.Profile.Id);
                }
            }

            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }

            return(View("ProfilesAndIndicators"));
        }