Beispiel #1
0
 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)
     });
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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
            });
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
 ///<summary>
 ///异步更新
 ///</summary>
 public async Task <int> UpdateAsync(OaAttachment oaAttachment)
 {
     return(await OaAttachmentRepository.UpdateAsync(oaAttachment));
 }
Beispiel #6
0
 ///<summary>
 ///更新
 ///</summary>
 public int Update(OaAttachment oaAttachment)
 {
     return(OaAttachmentRepository.Update(oaAttachment));
 }
Beispiel #7
0
 ///<summary>
 ///异步新增
 ///</summary>
 public async Task <string> InsertAsync(OaAttachment oaAttachment)
 {
     return(await OaAttachmentRepository.InsertAsync(oaAttachment));
 }
Beispiel #8
0
 ///<summary>
 ///新增
 ///</summary>
 public string Insert(OaAttachment oaAttachment)
 {
     return(OaAttachmentRepository.Insert(oaAttachment));
 }
Beispiel #9
0
 public ResponseMessage <int> Update([FromBody] OaAttachment oaAttachment)
 {
     return(new ResponseMessage <int> {
         data = _oaAttachmentService.Update(oaAttachment)
     });
 }
Beispiel #10
0
 public async Task <ResponseMessage <string> > InsertAsync([FromBody] OaAttachment oaAttachment)
 {
     return(new ResponseMessage <string> {
         data = await _oaAttachmentService.InsertAsync(oaAttachment)
     });
 }
Beispiel #11
0
 public ResponseMessage <string> Insert([FromBody] OaAttachment oaAttachment)
 {
     return(new ResponseMessage <string> {
         data = _oaAttachmentService.Insert(oaAttachment)
     });
 }