public async Task <ResponseMessage <int> > UpdateAsync([FromBody] OaAttachment oaAttachment) { //OaAttachment entity = await _oaAttachmentService.GetByIdAsync(oaAttachment.id); //Utils.CommmonUtils.EntityToEntity(oaAttachment, entity, null); //return new ResponseMessage<int> { data = await _oaAttachmentService.UpdateAsync(entity) }; return(new ResponseMessage <int> { data = await _oaAttachmentService.UpdateAsync(oaAttachment) }); }
public Response <List <OaAttachment> > GetAttachById(string id) { var result = new Response <List <OaAttachment> >(); List <OaAttachment> reslst = new List <OaAttachment>(); if (!string.IsNullOrEmpty(id)) { var idarr = id.Split(','); foreach (var item in idarr) { OaAttachment attach = _atachmentapp.GetById(item); reslst.Add(attach); } } result.Result = reslst; return(result); }
public ResponseMessage <object> QueryByIds(string ids) { var res = new List <OaAttachment>(); if (!string.IsNullOrEmpty(ids)) { var idarr = ids.Split(','); foreach (var item in idarr) { OaAttachment attach = _oaAttachmentService.GetById(item); res.Add(attach); } } //var res = _oaAttachmentService.QueryByIds(ids); return(new ResponseMessage <object> { data = res }); }
public JsonResult UploadFile(IFormFile file) { string id = ""; if (file != null) { var fileDir = "D:\\wopi\\files"; if (!Directory.Exists(fileDir)) { Directory.CreateDirectory(fileDir); } //文件名称 string projectFileName = file.FileName; //上传的文件的路径 string filePath = fileDir + $@"\{projectFileName}"; if (!System.IO.File.Exists(filePath)) { using (FileStream fs = System.IO.File.Create(filePath)) { file.CopyTo(fs); fs.Flush(); } OaAttachment oaAttachment = new OaAttachment(); oaAttachment.file_name = file.FileName; var namearr = file.FileName.Split('.'); oaAttachment.file_ext = namearr[namearr.Length - 1]; oaAttachment.file_size = file.Length.ToString(); oaAttachment.publish_path = string.Format("D:\\wopi\\files\\{0}", file.FileName); oaAttachment.group_id = "GXBBWGKGLJ"; id = _atachmentapp.Add(oaAttachment); } else { id = _atachmentapp.QueryIdByPath(filePath); } } else { return(Json("no")); } return(Json(id)); }
///<summary> ///异步更新 ///</summary> public async Task <int> UpdateAsync(OaAttachment oaAttachment) { return(await OaAttachmentRepository.UpdateAsync(oaAttachment)); }
///<summary> ///更新 ///</summary> public int Update(OaAttachment oaAttachment) { return(OaAttachmentRepository.Update(oaAttachment)); }
///<summary> ///异步新增 ///</summary> public async Task <string> InsertAsync(OaAttachment oaAttachment) { return(await OaAttachmentRepository.InsertAsync(oaAttachment)); }
///<summary> ///新增 ///</summary> public string Insert(OaAttachment oaAttachment) { return(OaAttachmentRepository.Insert(oaAttachment)); }
public ResponseMessage <int> Update([FromBody] OaAttachment oaAttachment) { return(new ResponseMessage <int> { data = _oaAttachmentService.Update(oaAttachment) }); }
public async Task <ResponseMessage <string> > InsertAsync([FromBody] OaAttachment oaAttachment) { return(new ResponseMessage <string> { data = await _oaAttachmentService.InsertAsync(oaAttachment) }); }
public ResponseMessage <string> Insert([FromBody] OaAttachment oaAttachment) { return(new ResponseMessage <string> { data = _oaAttachmentService.Insert(oaAttachment) }); }