コード例 #1
0
ファイル: LoanTypeController.cs プロジェクト: raeville/CBA
 public IHttpActionResult Post(LoanTypeModel loanTypeModel)
 {
     try
     {
         LoanTypeModel _loanTypeModel = new LoanTypeModel();
         // _loanTypeModel.Id = loanTypeModel.Id;
         _loanTypeModel.TypeDesc = loanTypeModel.TypeDesc;
         _loanTypeModel.IsDeleted = loanTypeModel.IsDeleted;
         _loanTypeModel.CreateDate = loanTypeModel.CreateDate;
         _loanTypeModel.UpdateDate = loanTypeModel.UpdateDate;
         db.Add(_loanTypeModel);
         return Ok();
     }
     catch (HttpResponseException)
     {
         return NotFound();
     }
 }
コード例 #2
0
ファイル: LoanTypeController.cs プロジェクト: raeville/CBA
        public IHttpActionResult Put(LoanTypeModel loanTypeModel)
        {
            try
            {
                LoanTypeModel _loanTypeModel = db.Query<LoanTypeModel>().Where(x => x.Id == loanTypeModel.Id).FirstOrDefault();
                if (_loanTypeModel == null)
                {
                    return NotFound();
                }
                else
                {
                    _loanTypeModel.TypeDesc = loanTypeModel.TypeDesc;
                    _loanTypeModel.CreateDate = loanTypeModel.CreateDate;
                    _loanTypeModel.UpdateDate = loanTypeModel.UpdateDate;
                    db.SaveChanges(_loanTypeModel);
                    return Ok();
                }
            }
            catch (HttpResponseException)
            {

                return NotFound();
            }
        }