using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using BLL;

namespace WebAPI.Controllers
{
    public class JointInfoController : ApiController
    {
        #region 保存焊口信息
        /// <summary>
        /// 保存焊口信息
        /// </summary>
        /// <param name="addItem">焊口项</param>
        /// <returns></returns>
        [HttpPost]
        public Model.ResponeData PostSaveJointInfo([FromBody] Model.JointInfoItem addItem)
        {
            var responeData = new Model.ResponeData();
            try
            {
                BLL.APIJointInfoService.SaveJointInfo(addItem);
            }
            catch (Exception ex)
            {
                responeData.code = 0;
                responeData.message = ex.Message;
            }

            return responeData;
        }
        #endregion

        #region 批量保存焊口信息
        /// <summary>
        /// 批量保存焊口信息
        /// </summary>
        /// <param name="addItems">焊口项</param>
        /// <returns></returns>
        [HttpPost]
        public Model.ResponeData PostSaveJointInfoList([FromBody] List<Model.JointInfoItem> addItems)
        {
            var responeData = new Model.ResponeData();
            try
            {
                BLL.APIJointInfoService.SaveBatchJointInfo(addItems);
            }
            catch (Exception ex)
            {
                responeData.code = 0;
                responeData.message = ex.Message;
            }

            return responeData;
        }
        #endregion
    }
}