// GET: /DataCenter/Contacts/Create public ActionResult Create() { //پر کردن دراپ دون لیستها IEnumerable <DomainClasses.Models.PseezEnt.Common.ContactList> ContactLists; if (User.IsInRole("Admin") || User.IsInRole("ContactListAdmin")) { ContactLists = _contactListService.GetAll(); } else { var userId = _identityUserService.FindUserIdByName(User.Identity.Name); var userContactLists = _userContactListService.GetAll(r => r.UserId == userId).Select(r => r.ContactListId); ContactLists = _contactListService.GetAll(r => userContactLists.Contains(r.Id)); } ViewBag.ContactListNames = new SelectList(ContactLists, "Name", "Name"); if (ContactLists.Count() != 0) { var firstContactListId = ContactLists.FirstOrDefault().Id; string ContactGroupNamesSelect = null; //ContactGroupNamesSelect = null; foreach ( var contactGroupName in _contactGroupService.GetAll(r => r.ContactListId == firstContactListId).Select(r => r.Name)) { ContactGroupNamesSelect += "<option value=\"" + contactGroupName + "\">" + contactGroupName + "</option>"; } ViewBag.ContactGroupNames = ContactGroupNamesSelect; } return(PartialView("_Create")); }
// GET: /ContactList/ContactGroup/Create public ActionResult Create() { //IContactListService _contactListService = new EfContactListService(_uow); ViewBag.ContactListNames = new SelectList(_contactListService.GetAll(), "Name", "Name"); //IEnumerable<SelectListItem> list = _contactListService.GetAll(); //ViewBag.ContactListNames = new SelectList(list, "Name", "Name"); return(PartialView("_Create")); }
// GET: /ContactList/UserContactList/Create public ActionResult Create() { ViewBag.ContactListNames = new SelectList(_contactListService.GetAll(), "Name", "Name"); IEnumerable <string> UserNames = _identityUserService.GetAllUserNames(); ViewBag.UserNames = new SelectList(UserNames); //_identityUserService return(PartialView("_Create")); }
public ActionResult Read() { IEnumerable <ContactListViewModel> a = from r in _contactListService.GetAll() select new ContactListViewModel { Id = r.Id, Name = r.Name, Description = r.Description, CreatedBy = _identityUserService.FindUserNameById(r.UserId) }; return(Json(a, JsonRequestBehavior.AllowGet)); }