public Int32 insertTaxType(Models.MstTaxType taxType)
        {
            try
            {
                var userId = (from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d.Id).SingleOrDefault();

                Data.MstTaxType newTaxType = new Data.MstTaxType();
                newTaxType.TaxType         = taxType.TaxType;
                newTaxType.TaxRate         = taxType.TaxRate;
                newTaxType.IsInclusive     = taxType.IsInclusive;
                newTaxType.AccountId       = taxType.AccountId;
                newTaxType.IsLocked        = taxType.IsLocked;
                newTaxType.CreatedById     = userId;
                newTaxType.CreatedDateTime = DateTime.Now;
                newTaxType.UpdatedById     = userId;
                newTaxType.UpdatedDateTime = DateTime.Now;

                db.MstTaxTypes.InsertOnSubmit(newTaxType);
                db.SubmitChanges();

                return(newTaxType.Id);
            }
            catch
            {
                return(0);
            }
        }
        public HttpResponseMessage updateTaxType(String id, Models.MstTaxType taxType)
        {
            try
            {
                var userId = (from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d.Id).SingleOrDefault();

                var taxTypes = from d in db.MstTaxTypes where d.Id == Convert.ToInt32(id) select d;
                if (taxTypes.Any())
                {
                    var updateTaxType = taxTypes.FirstOrDefault();
                    updateTaxType.TaxType         = taxType.TaxType;
                    updateTaxType.TaxRate         = taxType.TaxRate;
                    updateTaxType.IsInclusive     = taxType.IsInclusive;
                    updateTaxType.AccountId       = taxType.AccountId;
                    updateTaxType.IsLocked        = taxType.IsLocked;
                    updateTaxType.UpdatedById     = userId;
                    updateTaxType.UpdatedDateTime = DateTime.Now;

                    db.SubmitChanges();

                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }