public HttpResponseMessage updatePayType(String id, Models.MstPayType payType)
        {
            try
            {
                var userId = (from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d.Id).SingleOrDefault();

                var payTypes = from d in db.MstPayTypes where d.Id == Convert.ToInt32(id) select d;
                if (payTypes.Any())
                {
                    var updatePayType = payTypes.FirstOrDefault();

                    updatePayType.PayType         = payType.PayType;
                    updatePayType.AccountId       = payType.AccountId;
                    updatePayType.IsLocked        = payType.IsLocked;
                    updatePayType.UpdatedById     = userId;
                    updatePayType.UpdatedDateTime = DateTime.Now;;

                    db.SubmitChanges();

                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
        public Int32 insertPayType(Models.MstPayType payType)
        {
            try
            {
                var userId = (from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d.Id).SingleOrDefault();

                Data.MstPayType newPayType = new Data.MstPayType();
                newPayType.PayType         = payType.PayType;
                newPayType.AccountId       = payType.AccountId;
                newPayType.IsLocked        = payType.IsLocked;;
                newPayType.CreatedById     = userId;
                newPayType.CreatedDateTime = DateTime.Now;
                newPayType.UpdatedById     = userId;
                newPayType.UpdatedDateTime = DateTime.Now;

                db.MstPayTypes.InsertOnSubmit(newPayType);
                db.SubmitChanges();

                return(newPayType.Id);
            }
            catch
            {
                return(0);
            }
        }