public ActionResult _OtherExpenseForm(OtherExpenseCreateViewModel model)
 {
     if (ModelState.IsValid)
     {
         int result = OtherExpenseQueries.CreateOtherExpense(model, UserQueries.GetCurrentUsername());
         if (result > 0)
         {
             return(Content("success"));
         }
         else
         {
             return(Content("failed"));
         }
     }
     else
     {
         return(PartialView());
     }
 }
        public static int CreateOtherExpense(OtherExpenseCreateViewModel model, string username)
        {
            Entities entities = new Entities();
            DateTime current  = DateTime.Now;

            Expenses otherExpense = new Expenses();

            otherExpense.Name        = model.Source;
            otherExpense.ExpenseDay  = model.ExpenseDay.Value;
            otherExpense.Value       = model.Expense.Value;
            otherExpense.Note        = model.Note;
            otherExpense.ExpenseType = (int)Constants.Constants.EXPENSE_TYPE.OTHERS;
            otherExpense.StartDate   = current;
            otherExpense.CreatedDate = current;
            otherExpense.CreatedBy   = Constants.Constants.USER;
            otherExpense.Username    = username;

            entities.Expenses.Add(otherExpense);
            return(entities.SaveChanges());
        }