Exemple #1
0
        public JsonResult ListAllUsers()
        {
            foreach (var user in db.Users)
            {
                var viewModel = new UserListViewModel()
                {
                    Address = user.Address,
                    //BloodGroup = user.BloodGroup,
                    //CitizenShipNumber = user.CitizenShipNumber,
                    //CreatedBy = user.CreatedBy,
                    //CreatedDate = user.CreatedDate,
                    //DateOfBirth = user.DateOfBirth,
                    Email = user.Email,
                    ImageFile = user.ImageFile,
                    //ModifiedBy = user.ModifiedBy,
                    //ModifiedDate = user.ModifiedDate,
                    //Nationality = user.Nationality,
                    //Password = user.Password,
                    //PhoneNumber = user.PhoneNumber,
                    //Religion = user.Religion,
                    //Sex = user.Sex,
                    //UserName = user.UserName,
                    Name = user.FirstName + " " + user.MiddleName + " " + user.LastName,

                };
                viewModels.Add(viewModel);
            }
            return Json(viewModels,JsonRequestBehavior.AllowGet);
        }
Exemple #2
0
 //
 // GET: /User/Delete/5
 //[Authorize(Roles = "SuperAdmin")]
 public ActionResult Delete(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     User user = db.Users.Find(id);
     if (user == null)
     {
         return HttpNotFound();
     }
     var userViewModel = new UserListViewModel()
     {
         Address = user.Address,
         Name = user.FirstName + " " + user.MiddleName + " " + user.LastName,
         //BloodGroup = user.BloodGroup,
         //CitizenShipNumber = user.CitizenShipNumber,
         //CreatedBy = user.CreatedBy,
         //CreatedDate = user.CreatedDate,
         //DateOfBirth = user.DateOfBirth,
         //Email = user.Email,
         //ImageFile = user.ImageFile,
         //ModifiedBy = user.ModifiedBy,
         //ModifiedDate = user.ModifiedDate,
         //Nationality = user.Nationality,
         //Password = user.Password,
         //PhoneNumber = user.PhoneNumber,
         //Religion = user.Religion,
         //Sex = user.Sex,
         //UserName = user.UserName,
         //FirstName = user.FirstName,
         //MiddleName = user.MiddleName,
         //LastName = user.LastName,
     };
     return View(userViewModel);
 }