public void Delete(string id) { ObjectId oid = ObjectId.Parse(id); CooperativePartner partner = client.FindOne <CooperativePartner>(new { _id = oid }); client.DeleteOneById <CooperativePartner>(partner); }
/// <summary> /// 合作伙伴 /// </summary> public ActionResult Index(string id) { ObjectId oid = ObjectId.Parse(id); CooperativePartner partner = client.FindOne <CooperativePartner>(new { _id = oid }); if (partner == null) { partner = new CooperativePartner(); } return(View(partner)); }
public ActionResult Index(HttpPostedFileWrapper file, CooperativePartner partner, string imgnames) { if (file != null) { string imgname = Guid.NewGuid().ToString() + ".jpg"; string imgpath = Server.MapPath("~/upload/image/" + imgname); file.SaveAs(imgpath); partner.ImgPath = "/upload/image/" + imgname; partner.Name = imgnames; client.InsertOne(partner); } return(RedirectToAction("Index")); }
public ActionResult Index(HttpPostedFileWrapper file, string _id, string imgnames) { ObjectId oid = ObjectId.Parse(_id); string imgname = Guid.NewGuid().ToString() + ".jpg"; string imgpath = Server.MapPath("~/upload/image/" + imgname); file.SaveAs(imgpath); CooperativePartner partner = client.FindOne <CooperativePartner>(new { _id = oid }); partner.ImgPath = "/upload/image/" + imgname; partner.Language = Language; partner.Name = imgnames; client.UpdateOneById(partner); return(RedirectToAction("Index", new { id = _id })); }
public static CooperativePartnerView EntityMap(this CooperativePartner model) { return(Mapper.Map <CooperativePartner, CooperativePartnerView>(model)); }