コード例 #1
0
 public Master PostMasters(inUnitResult inUnitResult)
 {
     try
     {
         Master input = new Master
         {
             Id     = Guid.NewGuid(),
             Date   = DateTime.UtcNow,
             Value1 = inUnitResult.Value1,
             Value2 = inUnitResult.Value2
         };
         Master _master = _iMasterDAO.Post_Master(input);
         return(_master);
     }
     catch (Exception e)
     {
         throw new Exception();
     }
 }
コード例 #2
0
        public outUniResult Post([FromBody] inUnitResult inUnitResult)
        {
            outUniResult _outUniResult = new outUniResult();

            try
            {
                _outUniResult.StatusCode = (int)HttpStatusCode.OK;
                _outUniResult.Result     = _iMasterBLO.PostMasters(inUnitResult);
                _outUniResult.Error      = null;
                return(_outUniResult);
            }
            catch (Exception e)
            {
                ///2.送給前端的錯誤訊息,簡單就好
                _outUniResult.StatusCode = (int)HttpStatusCode.NotFound;
                _outUniResult.Result     = "發生錯誤了";
                _outUniResult.Error      = null;
                throw new Exception();
            }
        }