public ActionResult Products_Create([DataSourceRequest]DataSourceRequest request, Customer_ product)
{
if (ModelState.IsValid)
{
using (var northwind = new StreeboRevForecastModel_Entities())
{
var entity = new Customer_
{
Customer_ID = product.Customer_ID,
Customer_Name = product.Customer_Name,
Costomer_Country = product.Costomer_Country,
Customer_State = product.Customer_State,
Customer_Status = product.Customer_Status,
Owner = product.Owner
};
northwind.Customer_.Add(entity);
northwind.SaveChanges();
product.Customer_ID = entity.Customer_ID;
}
}
return Json(new[] { product }.ToDataSourceResult(request, ModelState));
}
public ActionResult Products_Update([DataSourceRequest]DataSourceRequest request, Customer_ product)
{
if (ModelState.IsValid)
{
using (var northwind = new StreeboRevForecastModel_Entities())
{
var entity = new Customer_
{
Customer_ID = product.Customer_ID,
Customer_Name = product.Customer_Name,
Costomer_Country = product.Costomer_Country,
Customer_State = product.Customer_State,
Customer_Status = product.Customer_Status,
Owner = product.Owner
};
northwind.Customer_.Attach(entity);
northwind.Entry(entity).State = EntityState.Modified;
northwind.SaveChanges();
}
}
return Json(new[] { product }.ToDataSourceResult(request, ModelState));
}
public ActionResult Products_Destroy([DataSourceRequest]DataSourceRequest request, Customer_ product)
{
if (ModelState.IsValid)
{
using (var northwind = new StreeboRevForecastModel_Entities())
{
var entity = new Customer_
{
Customer_ID = product.Customer_ID,
Customer_Name = product.Customer_Name,
Costomer_Country = product.Costomer_Country,
Customer_State = product.Customer_State,
Customer_Status = product.Customer_Status,
Owner = product.Owner
};
northwind.Customer_.Attach(entity);
northwind.Customer_.Remove(entity);
northwind.SaveChanges();
}
}
return Json(new[] { product }.ToDataSourceResult(request, ModelState));
}
{
if (ModelState.IsValid)
{
using (var northwind = new StreeboRevForecastModel_Entities())
{
var entity = new Customer_
{
Customer_ID = product.Customer_ID,
Customer_Name = product.Customer_Name,
Costomer_Country = product.Costomer_Country,
Customer_State = product.Customer_State,
Customer_Status = product.Customer_Status,
Owner = product.Owner
};
northwind.Customer_.Add(entity);
northwind.SaveChanges();
product.Customer_ID = entity.Customer_ID;
}
}
return Json(new[] { product }.ToDataSourceResult(request, ModelState));
}
public ActionResult Products_Update([DataSourceRequest]DataSourceRequest request, Customer_ product)
{
if (ModelState.IsValid)
{
using (var northwind = new StreeboRevForecastModel_Entities())
{
var entity = new Customer_
{
Customer_ID = product.Customer_ID,
Customer_Name = product.Customer_Name,
Costomer_Country = product.Costomer_Country,
Customer_State = product.Customer_State,
Customer_Status = product.Customer_Status,
Owner = product.Owner
};
northwind.Customer_.Attach(entity);
northwind.Entry(entity).State = EntityState.Modified;
northwind.SaveChanges();
}
}
return Json(new[] { product }.ToDataSourceResult(request, ModelState));
}
public ActionResult Products_Destroy([DataSourceRequest]DataSourceRequest request, Customer_ product)
{
if (ModelState.IsValid)
{
using (var northwind = new StreeboRevForecastModel_Entities())
{
var entity = new Customer_
{
Customer_ID = product.Customer_ID,
Customer_Name = product.Customer_Name,
Costomer_Country = product.Costomer_Country,
Customer_State = product.Customer_State,
Customer_Status = product.Customer_Status,
Owner = product.Owner
};
northwind.Customer_.Attach(entity);
northwind.Customer_.Remove(entity);
northwind.SaveChanges();
}
}
return Json(new[] { product }.ToDataSourceResult(request, ModelState));
}