public bool UpdateProperty(string Id, PropertyList item) { IMongoQuery query = Query.EQ("_id", Id); item.Date=DateTime.Now; IMongoUpdate update = Update .Replace(item); WriteConcernResult result = _property.Update(query, update); return result.UpdatedExisting; }
public PropertyList AddProperty(PropertyList item, IEnumerable<HttpPostedFileBase> files) { item.Id = BsonObjectId.GenerateNewId().ToString(); item.Contact = (_property.Count() + 1).ToString(); item.Date = DateTime.Now; // Uploadvid(item.Contact, vid); _property.Save(item); return item; }
public PropertyList SaveProperty(PropertyList item) { _property.Save(item); return item; }
// GET: Property public ActionResult List() { var ent = new PropertyListRepository(); // var immg = _property.Getdb().GridFS.FindAll(); var model = _property.GetAllProperties().AsEnumerable(); foreach (var ppt in model) { var editor = new PropertyList() { Id = ppt.Id, Availability = ppt.Availability }; /// ent.AddProperty(editor, null); } return View(model); }
public ActionResult Edit(string Id, PropertyList item) { try { // TODO: Add update logic here _property.UpdateProperty(Id, item); return RedirectToAction("Map"); } catch { return View(); } }
public ActionResult Create(PropertyList property, IEnumerable<HttpPostedFileBase> files,HttpPostedFileBase planLink) { try { if(files.Count()==0|| files.FirstOrDefault() == null) { ViewBag.error = "Please choose a file"; } List<ImageGallery> Piclist=new List<ImageGallery>(); foreach(var file in files) { var model = new ImageGallery(); if (Piclist.Count == 0) { model.ID = "0"; } else { model.ID = (Piclist.Count + 1).ToString(); } model.Name = Guid.NewGuid().ToString(); var ext = Path.GetExtension(file.FileName).ToLower(); using (var img = Image.FromStream(file.InputStream)) { model.ThumbPath = string.Format("/Images/GalleryImages/thumbs/{0}{1}",model.Name,ext); model.ImagePath = string.Format("/Images/GalleryImages/{0}{1}", model.Name, ext); //Save Large Size SaveToFolder(img, model.Name, ext, new Size(600, 600), model.ImagePath); //Save thumb Size SaveToFolder(img, model.Name, ext, new Size(100, 100), model.ThumbPath); } Piclist.Add(model); } var xt = Path.GetExtension(planLink.FileName).ToLower(); var pat = string.Format("/Images/GalleryImages/Plans/{0}{1}",planLink.FileName, xt); using (var ig = Image.FromStream(planLink.InputStream)) { SaveToFolder(ig, planLink.FileName, xt, new Size(600, 600),pat); } property.planLink = pat; property.ImageList = Piclist; _property.AddProperty(property, files); // TODO: Add insert logic here return RedirectToAction("Map"); } catch { return View(property); } }
public ActionResult changeAvail(PropertyList model) { var selid = model.Id; var selctedppty = from x in _property.GetAllProperties() where selid.Contains(x.Id) select x; foreach(var pp in selctedppty) { System.Diagnostics.Debug.WriteLine(string.Format("{0} {1}", pp.Id, pp.Availability)); } return RedirectToAction("List"); }