using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
using IStation.Model.Api;
|
using AutoMapper;
|
using IStation.WebApi.Models;
|
using IStation.ViewModel;
|
using IStation.Untity;
|
using Microsoft.Web.Http;
|
|
namespace IStation.WebApi.Controllers
|
{
|
/// <summary>
|
/// 附件标准api
|
/// </summary>
|
[RoutePrefix("v1/Standard/AttachmentFile")]
|
[ApiVersion("v1")]
|
public class AttachmentFile_StandardController : ApiController
|
{
|
|
private readonly Service.AttachmentFile _service = new Service.AttachmentFile();
|
|
/// <summary>
|
/// 通过 BelongType 和 BelongID 获取
|
/// </summary>
|
[Route("GetByBelongTypeAndBelongID")]
|
[HttpGet]
|
public Result GetByBelongTypeAndBelongID(long CorpID, string BelongType,long BelongID)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Alert, "CorpID 参数错误");
|
}
|
if (string.IsNullOrEmpty(BelongType))
|
{
|
return new Result(Code.Alert, "BelongType 参数错误");
|
}
|
if (BelongID < 1)
|
{
|
return new Result(Code.Alert, "BelongID 参数错误");
|
}
|
var list = _service.GetByBelongTypeAndBelongID(CorpID, BelongType,BelongID);
|
var vm_list = list?.Select(x => new ViewModel.AttachmentFile(x)).ToList();
|
return new Result<List<ViewModel.AttachmentFile>>(vm_list);
|
}
|
|
|
|
|
}
|
}
|