public void Edit(int id) { advertisement advertisement = ActiveRecordBase <advertisement> .Find(id); PropertyBag["advertisementimages"] = advertisement.Images; PropertyBag["tags"] = ActiveRecordBase <tags> .FindAll(); PropertyBag["advertisement"] = ActiveRecordBase <advertisement> .Find(id); media_types imgtype = ActiveRecordBase <media_types> .Find(2); PropertyBag["images"] = imgtype.media_typed; //PropertyBag["images"] = ActiveRecordBase<media_repo>.FindAll(); PropertyBag["authors"] = ActiveRecordBase <users> .FindAll(); //PropertyBag["classifiedtype"] = ActiveRecordBase<ClassifiedType>.FindAll(); //PropertyBag["location"] = ActiveRecordBase<LocationType>.FindAll(); List <tags> tags = new List <tags>(); tags.AddRange(ActiveRecordBase <advertisement> .Find(id).Tags); int tagscounts = 0; if (ActiveRecordBase <advertisement> .Find(id).Tags != null) { tagscounts = ActiveRecordBase <advertisement> .Find(id).Tags.Count; } for (int i = tagscounts; i < 2; i++) { tags.Add(new tags()); } PropertyBag["advertisementtags"] = tags; RenderView("new"); }
public void Edit(int id, int page) { users user = ActiveRecordBase <users> .Find(id); if (!canControl(userService.getUserFull()) && user != userService.getUserFull()) { Flash["error"] = "Sorry you are not able to edit this user."; RedirectToAction("list"); return; } media_types imgtype = ActiveRecordBase <media_types> .Find(1); PropertyBag["images"] = imgtype.media_typed; //Flash["images"] != null ? Flash["images"] : PropertyBag["authorimages"] = user.media; PropertyBag["currentUser"] = userService.getUserFull(); PropertyBag["user"] = user; PropertyBag["groups"] = ActiveRecordBase <user_groups> .FindAll(); PropertyBag["models"] = ActiveRecordBase <place_models> .FindAll(); PropertyBag["types"] = ActiveRecordBase <place_types> .FindAll(); PropertyBag["accesslevels"] = ActiveRecordBase <user_groups> .FindAll(); PropertyBag["statuslists"] = ActiveRecordBase <status> .FindAll(); PropertyBag["categories"] = ActiveRecordBase <categories> .FindAll(); PropertyBag["campuses"] = ActiveRecordBase <campus> .FindAll(); PropertyBag["colleges"] = ActiveRecordBase <colleges> .FindAll(); PropertyBag["departments"] = ActiveRecordBase <departments> .FindAll(); PropertyBag["programs"] = ActiveRecordBase <programs> .FindAll(); PropertyBag["schools"] = ActiveRecordBase <schools> .FindAll(); PropertyBag["field_types"] = ActiveRecordBase <field_types> .FindAll(); PropertyBag["history"] = PaginationHelper.CreatePagination((IList)ActiveRecordBase <logs> .FindAll().Where(x => x.nid == user.nid).ToList(), 15, page); RenderView("new"); }
public void New() { users user = new users(); List <media_repo> images = new List <media_repo>(); //images.AddRange(user.media); if (images.Count == 0) { images.Add(new media_repo()); } PropertyBag["authorimages"] = images; media_types imgtype = ActiveRecordBase <media_types> .Find(1); PropertyBag["images"] = imgtype.media_typed; PropertyBag["currentUser"] = userService.getUserFull(); PropertyBag["authors"] = ActiveRecordBase <users> .FindAll(); PropertyBag["groups"] = ActiveRecordBase <user_groups> .FindAll(); PropertyBag["models"] = ActiveRecordBase <place_models> .FindAll(); PropertyBag["types"] = ActiveRecordBase <place_types> .FindAll(); PropertyBag["statuslists"] = ActiveRecordBase <status> .FindAll(); PropertyBag["categories"] = ActiveRecordBase <categories> .FindAll(); PropertyBag["campuses"] = ActiveRecordBase <campus> .FindAll(); PropertyBag["colleges"] = ActiveRecordBase <colleges> .FindAll(); PropertyBag["departments"] = ActiveRecordBase <departments> .FindAll(); PropertyBag["programs"] = ActiveRecordBase <programs> .FindAll(); PropertyBag["schools"] = ActiveRecordBase <schools> .FindAll(); }