Esempio n. 1
0
 public int Themloaixe(string tenloai, string gia, ObjectId csh)
 {
     if (tenloai != "" || gia != "" || csh != null)
     {
         LoaiXe_Model lx_model = new LoaiXe_Model();
         LoaiXe       lx       = new LoaiXe();
         lx.ChuSoHuu = csh;
         try
         {
             lx.GiaTien = Convert.ToInt32(gia);
         }
         catch
         {
             return(-2); // nếu người dùng nhập giá không phải là số;
         }
         lx.TenLoai = tenloai;
         try
         {
             lx_model.Create(lx);
             return(1); // thêm loại xe thành công
         }
         catch
         {
             return(0); // thêm thất bại
         }
     }
     else
     {
         return(-1); // giá trị truyền vào bị rỗng
     }
 }
Esempio n. 2
0
        public ActionResult QLLoaiXe()
        {
            var          session  = (BaiGuiXe_Smart_API.Models.UserSession.UserSession)Session["loginsession"];
            LoaiXe_Model lx_model = new LoaiXe_Model();
            var          lxlist   = lx_model.FindChuSoHuu(session.Id);

            return(View(lxlist));
        }