Пример #1
0
        public ActionResult Edit(long siteId, CompanyModel item, int?parentId)
        {
            bool isNew = item.ID == 0;

            if (isNew)
            {
                if (parentId.HasValue)
                {
                    item.ParentID = (int)parentId;
                }
                item.Creator    = Models.DataAccess.MemberDAO.SysCurrent.Id;
                item.CreateTime = DateTime.Now;
                comRepo.CreateItem(item, isWithIdentity: false);
            }
            else
            {
                item.Modifier   = Models.DataAccess.MemberDAO.SysCurrent.Id;
                item.ModifyTime = DateTime.Now;
                comRepo.UpdateItemExcept(item, new string[] { "ID", "ParentID", "Creator", "CreateTime" });
            }

            ViewBag.Exit   = true;
            ViewBag.SiteID = siteId;
            return(View(item));
        }