public IHttpActionResult PostcatCurrency(CatCurrencyViewModel Cat_CurrencyView_Model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            catCurrency catCurrency_db;
            try
            {
                catCurrency_db = new catCurrency { Id = Cat_CurrencyView_Model.Id, No = Cat_CurrencyView_Model.No, Name = Cat_CurrencyView_Model.Name };
                db.catCurrencies.Add(catCurrency_db);
                db.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, "DbEntityValidationException:" + ex.Message));
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return CreatedAtRoute("DefaultApi", new { id = catCurrency_db.Id }, ToViewModel(catCurrency_db));
        }
 private CatCurrencyViewModel ToViewModel(catCurrency c)
 {
     return new CatCurrencyViewModel { Id = c.Id, No = c.No, Name = c.Name, TimestampString = Convert.ToBase64String(c.Timestamp) };
 }