public ViewModel.ViewClassReport Add(ViewModel.ViewClassReport report) { ClassReport cr = _repository.Add(ViewClassReport.ToEntity(report)); report.Id = cr.Id; return(report); }
public ActionResult ViewReport(int?classid, int id = 0) { ViewClass @class = null; ViewClassReport report = null; if (classid > 0) { @class = client.Get((int)classid); report = @class.Reports[0]; } else if (id > 0) { ClassReportServiceClient rc = new ClassReportServiceClient(); report = rc.Get(id); @class = client.Get(report.ClassId); } int nowIndex = 0; for (int i = 0; i < @class.Reports.Count; i++) { if (@class.Reports[i].Id == report.Id) { nowIndex = i; break; } } //更多中移除当前活动 @class.Reports.RemoveAt(nowIndex); ViewBag.Class = @class; return(View(report)); }
public List <ViewClassReport> GetClassId(int ClassId) { List <ViewClassReport> list = new List <ViewClassReport>(); var report = _repository.GetClassId(ClassId); foreach (var item in report) { list.Add(ViewClassReport.ToViewModel(item)); } return(list); }
public JsonResult AddReport() { JavaScriptSerializer seria = new JavaScriptSerializer(); ViewClassReport report = seria.Deserialize <ViewClassReport>(Request.Form["data"]); ClassReportServiceClient client = new ClassReportServiceClient(); report.UserId = 0; client.Add(report); //qiqi 2015-11-23 //start 把Content中图片添加到相册YogaPicture,类型:6 YogaPictureServiceClient picclient = new YogaPictureServiceClient(); Regex rg = new Regex("src=\"([^\"]+)\"", RegexOptions.IgnoreCase); var m = rg.Match(report.Content); while (m.Success) { ViewYogaPicture picModel = new ViewYogaPicture(); picModel.PictureOriginal = m.Groups[1].Value;//这里就是图片路径 picModel.PictureType = 6; picModel.CreateTime = DateTime.Now; picModel.PictureName = "活动相册"; picModel.Uid = 100316;//管理员 picModel.CreateUser = 100316; picModel.PictureContent = "活动相册"; picModel.HitNum = 0; picModel.iAudio = 1; picModel.PictureSmall = ""; picModel.AlbumId = 0; picModel.EvaluateId = 0; picModel.Comid = 0; picModel.PictureLarge = ""; picModel.PictureMiddle = ""; picModel.PircureSize = ""; picModel.CommentCount = 0; picModel.LikeCount = 0; picModel.NotLikeCount = 0; picModel.CommentLimite = 0; picModel.LastChangeTime = DateTime.Now; picclient.Add(picModel); m = m.NextMatch(); } //end return(Json(report)); }
// 添加活动报道 public ActionResult AddReport(int classId, int?id) { ViewClassReport report = new ViewClassReport(); if (id != null) { ClassReportServiceClient client = new ClassReportServiceClient(); report = client.Get((int)id); } else { report.Id = 0; report.ClassId = 0; } return(View(report)); }
public ViewClassReport Add(ViewClassReport report) { report.CreateTime = DateTime.Now; report.IsDeleted = false; if (report.Id > 0) { _impl.Edit(report); } else { _impl.Add(report); } if (report.Id > 0) { ClassFileServiceClient client = new ClassFileServiceClient(); foreach (var item in report.Images) { item.CreateTime = DateTime.Now; item.ExtendName = item.Url.Substring(item.Url.LastIndexOf('.')); item.Type = 11;//活动图片 item.Title = ""; item.ReportId = report.Id; item.IsDeleted = false; } if (report.Images.Count > 0) { client.AddList(report.Images); } foreach (var item in report.Videos) { item.CreateTime = DateTime.Now; item.ExtendName = item.Url.Substring(item.Url.LastIndexOf('.')); item.Type = 12;//活动视频 item.Title = ""; item.ReportId = report.Id; item.IsDeleted = false; } if (report.Videos.Count > 0) { client.AddList(report.Videos); } } return(report); }
public int AddClassReport(ViewClassReport report) { throw new NotImplementedException(); }
public bool Edit(ViewClassReport report) { throw new NotImplementedException(); }
public ViewModel.ViewClassReport Get(int id) { ClassReport report = _repository.Get(id); return(ViewClassReport.ToViewModel(report)); }
public bool Edit(ViewModel.ViewClassReport report) { _repository.Update(ViewClassReport.ToEntity(report)); _repository.Save(); return(true); }