Exemple #1
0
 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();
     }
 }
Exemple #2
0
        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();
            }
        }