protected void CreateBrand_Click(object sender, EventArgs e) { try { Objbnd.BrandName = BrandName.Text; Objbnd.BrandDesc = BrandDesc.Text; string Filepath = string.Empty; if (file.HasFile) { string fileName = Path.GetFileName(file.PostedFile.FileName); Objbnd.BrandImgUrl = fileName; file.PostedFile.SaveAs(Server.MapPath("~/Images/BrandLogos") + fileName); } int Status = BndObj.CreateBrand(Objbnd); if (Status.Equals(1)) { TxtMsg.Text = "New brand created success."; } else { TxtMsg.Text = "While creating brand error. Please try agin."; } } catch (Exception ex) { throw ex; } }
protected void EditBrands_Click(object sender, EventArgs e) { Brand _ObjBnd = new Brand(); _ObjBnd.BrandID = Convert.ToInt32(BrandId.Value); _ObjBnd.BrandName = BrandName.Text; _ObjBnd.BrandDesc = BrandDesc.Text; if (file.HasFile) { string fileName = Path.GetFileName(file.PostedFile.FileName); _ObjBnd.BrandImgUrl = fileName; file.PostedFile.SaveAs(Server.MapPath("~/Images/BrandLogos") + fileName); } else { _ObjBnd.BrandImgUrl = BrandImgUrl.Value; } int Status = Objbnd.CreateBrand(_ObjBnd); if (Status.Equals(1)) { TxtMsg.Text = "New brand update success."; } else { TxtMsg.Text = "While update brand error. Please try agin."; } }