public ITIResult InsertITIResult(ITIResult iTIResult)
        {
            var inserted = iTIDataEntities.ITIResults.Add(iTIResult);

            iTIDataEntities.SaveChanges();
            return(inserted);
        }
 public ActionResult Delete(int id = 0)
 {
     ITIResult iTIResult = new ITIResult();
     if (id > 0)
     {
         iTIResultRepository.DeleteITIResults(id);
     }
     return RedirectToAction("Index");
 }
 public ActionResult Create(int id = 0)
 { 
     ITIResult iTIResult = new ITIResult();
     if (id > 0)
     {
         iTIResult = iTIResultRepository.GetResultListById(id);
     }
     ViewBag.Trade = StaticData.GetTrade();
     ITIResultModel iTIResultModel = new ITIResultModel
     {
         ID=iTIResult.ID,
         CertificateIssued=iTIResult.CertificateIssued,
         Passout=iTIResult.Passout,
         Session=iTIResult.Session,
         TotalAppeared=iTIResult.TotalAppeared,
         TotalStudent=iTIResult.TotalStudent,
         Trade=iTIResult.Trade
     };
     return View(iTIResultModel);
 }
 public ActionResult Create(ITIResultModel iTIResultModel)
 {
     try
     {
         ITIResult iTIResult = new ITIResult
         {
             ID = iTIResultModel.ID,
             CertificateIssued = iTIResultModel.CertificateIssued,
             Passout = iTIResultModel.Passout,
             Session = iTIResultModel.Session,
             TotalAppeared = iTIResultModel.TotalAppeared,
             TotalStudent = iTIResultModel.TotalStudent,
             Trade = iTIResultModel.Trade
         };
         ViewBag.Trade = StaticData.GetTrade();
         if (ModelState.IsValid)
         {
             if (iTIResult.ID > 0)
             {
                 iTIResultRepository.UpdateITIResult(iTIResult);                    }
             else
             {
                 iTIResultRepository.InsertITIResult(iTIResult); 
             }
         }
         else
         {
             return View(iTIResultModel);
         }
         return RedirectToAction("Index");
     }
     catch (Exception)
     {
         return View(iTIResultModel);
     }
 }
 public ITIResult UpdateITIResult(ITIResult iTIResult)
 {
     iTIDataEntities.Entry(iTIResult).State = EntityState.Modified;
     iTIDataEntities.SaveChanges();
     return(iTIResult);
 }