public ActionResult CreateCate() { OLoaiTrangTinh data = new OLoaiTrangTinh(); data.TrangThai = false; return(View("UpdateCate", data)); }
public void Add(OLoaiTrangTinh item) { conn.connect(); var comm = new SqlCommand("LoaiTrangTinh_Add", conn.db); comm.CommandType = System.Data.CommandType.StoredProcedure; comm.Parameters.Add(new SqlParameter("@MoTa", item.MoTa ?? (object)DBNull.Value)); comm.Parameters.Add("@TenLoai", SqlDbType.NVarChar).Value = item.TenLoai; comm.Parameters.Add("@IsActive", SqlDbType.Bit).Value = item.TrangThai; comm.Parameters.Add("@TenVanTat", SqlDbType.NVarChar).Value = Help.Helper.convertToUnSign3(item.TenLoai); comm.ExecuteNonQuery(); conn.Close(); }
public OLoaiTrangTinh GetByShortName(string shortname) { conn.connect(); var comm = new SqlCommand("LoaiTrangTinh_GetByShortName", conn.db); comm.CommandType = CommandType.StoredProcedure; OLoaiTrangTinh item = new OLoaiTrangTinh(); comm.Parameters.Add("@TenVanTat", SqlDbType.NVarChar).Value = shortname; DataTable dt = new DataTable(); dt.Load(comm.ExecuteReader()); item = Help.DAL.ConvertDataTable <OLoaiTrangTinh>(dt).FirstOrDefault(); conn.Close(); return(item); }
public OLoaiTrangTinh Get(int id) { conn.connect(); var comm = new SqlCommand("LoaiTrangTinh_Get", conn.db); comm.CommandType = CommandType.StoredProcedure; OLoaiTrangTinh item = new OLoaiTrangTinh(); comm.Parameters.Add("@MaLoai", SqlDbType.Int).Value = id; DataTable dt = new DataTable(); dt.Load(comm.ExecuteReader()); item = Help.DAL.ConvertDataTable <OLoaiTrangTinh>(dt).FirstOrDefault(); conn.Close(); return(item); }
public ActionResult CreateCate(OLoaiTrangTinh model) { if (ModelState.IsValid) { try { model.TenVanTat = Help.Helper.convertToUnSign3(model.TenLoai); loaiTrangTinhService.Add(model); return(RedirectToAction("SearchCate", "QuanLyTrangTinh")); } catch (Exception e) { } } ViewBag.IsEdit = true; return(View("Update", model)); }