Esempio n. 1
0
        public ActionResult UserDelete(string ids)
        {
            AjaxResult result;

            try
            {
                int[]                    idArray    = ids.Split(',').Select(o => int.Parse(o)).ToArray();
                FluentModel              db         = Session.GetFluentModel();
                SuncereUserRepository    repository = new SuncereUserRepository(db);
                IQueryable <SuncereUser> query      = repository.Query(idArray);
                foreach (SuncereUser user in query)
                {
                    foreach (SuncereRole role in user.SuncereRoles)
                    {
                        role.SuncereUsers.Remove(user);
                    }
                    user.SuncereRoles.Clear();
                }
                db.Delete(query);
                db.SaveChanges();
                result = AjaxResult.GetDeleteAjaxResult(true);
            }
            catch (Exception e)
            {
                result = AjaxResult.GetDeleteAjaxResult(false);
            }
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
Esempio n. 2
0
        public ActionResult UserList(DateTime?startTime, DateTime?endTime, string keyword)
        {
            FluentModel           db         = Session.GetFluentModel();
            SuncereUserRepository repository = new SuncereUserRepository(db);
            List <SuncereUser>    list       = repository.Query(startTime, endTime, keyword).ToList();

            ViewData["startTime"] = startTime;
            ViewData["endTime"]   = endTime;
            ViewData["keyword"]   = keyword;
            return(View(list));
        }