Hello,YOu Can Refer This Is Of MVC But You Can Refer this ...It Might Help You
..
public ActionResult Display(HttpPostedFileBase file)
{
if (file != null)
{
EmployeeEntities context = new EmployeeEntities();
string ImageName = System.IO.Path.GetFileName(file.FileName);
string physicalPath = Server.MapPath("~/Images/" + ImageName);
file.SaveAs(physicalPath);
Image newRecord = new Image
{
fname = Request.Form["fname"],
lname = Request.Form["lname"],
ImageUrl = ImageName
};
_imgRepo.Insert(newRecord);
context.SaveChanges();
PhotoForSingleItem tempmodel = new PhotoForSingleItem();
tempmodel.Images = _imgRepo.GetEntities().ToList();
return View("Display",tempmodel);
}
return null;
..
This Code Is OF Controller...It Will surely Help You..
In _imgRepo.insert(newrecord)
context.savechanges();////You Can Write Your Insert Code ..
But Main Part Is Of PhysicalPath..
Thanks