public ActionResult SaveYear(string Year) { FC_ForecastYears forecast = new FC_ForecastYears(); forecast.Year = Year; forecast.CreateDate = DateTime.Now;; forecast.CreateID = user.UserName; forecast.UpdateDate = DateTime.Now;; forecast.UpdateID = user.UserName; db.FC_ForecastYears.Add(forecast); db.SaveChanges(); return(Json(new { }, JsonRequestBehavior.AllowGet)); }
public ActionResult Updateforecast(FC_ForecastYears data) { FC_ForecastYears forecast = (from c in db.FC_ForecastYears where c.Year == data.Year select c).FirstOrDefault(); forecast.Apr = data.Apr; forecast.May = data.May; forecast.Jun = data.Jun; forecast.Jul = data.Jul; forecast.Aug = data.Aug; forecast.Sep = data.Sep; forecast.Oct = data.Oct; forecast.Nov = data.Nov; forecast.Dec = data.Dec; forecast.Jan = data.Jan; forecast.Feb = data.Feb; forecast.Mar = data.Mar; forecast.UpdateDate = DateTime.Now;; forecast.UpdateID = user.UserName; db.Entry(forecast).State = EntityState.Modified; db.SaveChanges(); return(Json(new { }, JsonRequestBehavior.AllowGet)); }