public BrandOL GetById(int id) { BrandOL objbrand = new BrandOL(); objbrand = new BrandDL().GetById(id); return(objbrand); }
public BrandOL GetById(string id) { int Id = Convert.ToInt32(id); BrandOL objbrand = new BrandOL(); objbrand = new BrandBL().GetById(Id); HttpContext.Current.Session["Image"] = objbrand.Image; return(objbrand); }
public int Delete(int id) { BrandOL brandol = new BrandOL(); brandol.Id = id; brandol.ModifiedBy = 1; brandol.ModifiedDate = DateTime.UtcNow.AddHours(5.5); using (IDbConnection db = new SqlConnection(dbConnection)) { string sqlQuery = "UPDATE Brands SET IsDeleted = 1 , LastModifiedBy=1 WHERE Id = " + id; int rowsAffected = db.Execute(sqlQuery, brandol); return(rowsAffected); } }
public int Add(string name, string Image) { BrandOL brandol = new BrandOL(); brandol.Name = name; brandol.Image = Image; brandol.CreatedBy = 1; brandol.CreatedDate = DateTime.UtcNow.AddHours(5.5); using (IDbConnection db = new SqlConnection(dbConnection)) { string sqlQuery = "INSERT INTO Brands (Name,Image,CreatedBy,CreatedDate,IsDeleted) VALUES ('" + name + "','" + Image + "',1," + brandol.CreatedDate.ToString("dd/MM/yyyy") + ",0)"; int rowsAffected = db.Execute(sqlQuery, brandol); return(rowsAffected); } }
public int Edit(int id, string name, string image) { BrandOL brandol = new BrandOL(); brandol.Name = name; brandol.Id = id; brandol.Image = id + "_" + image; brandol.ModifiedBy = 1; brandol.ModifiedDate = DateTime.UtcNow.AddHours(5.5); using (IDbConnection db = new SqlConnection(dbConnection)) { string sqlQuery = "UPDATE Brands SET Name = '" + name + "',Image='" + brandol.Image + "' ,LastModifiedBy=1 WHERE Id = " + id; int rowsAffected = db.Execute(sqlQuery, brandol); return(id); } }