public PlacementTable InsertPlacement(PlacementTable placementTable)
        {
            var inserted = iTIDataEntities.PlacementTables.Add(placementTable);

            iTIDataEntities.SaveChanges();
            return(inserted);
        }
Example #2
0
        public ActionResult Delete(int id = 0)
        {
            PlacementTable placementTable = new PlacementTable();

            if (id > 0)
            {
                placementTableRepository.DeletePlacement(id);
            }
            return(RedirectToAction("Index"));
        }
Example #3
0
        public ActionResult Create(int id = 0)
        {
            ViewBag.Trade = StaticData.GetTrade();
            PlacementTable placementTable = new PlacementTable();

            if (id > 0)
            {
                placementTable = placementTableRepository.GetPlacementbyID(id);
            }
            PlacementTableModel placementTableModel = new PlacementTableModel
            {
                ID           = placementTable.ID,
                Name         = placementTable.Name,
                Org_Name     = placementTable.Org_Name,
                SalaryOnJoin = placementTable.SalaryOnJoin,
                Trade        = placementTable.Trade,
                PassingYear  = placementTable.PassingYear,
                Roll_No      = placementTable.Roll_No
            };

            return(View(placementTableModel));
        }
Example #4
0
 public ActionResult Create(PlacementTableModel placementTableModel)
 {
     try
     {
         PlacementTable placementTable = new PlacementTable
         {
             ID           = placementTableModel.ID,
             Name         = placementTableModel.Name,
             Org_Name     = placementTableModel.Org_Name,
             SalaryOnJoin = placementTableModel.SalaryOnJoin,
             Trade        = placementTableModel.Trade,
             PassingYear  = placementTableModel.PassingYear,
             Roll_No      = placementTableModel.Roll_No
         };
         ViewBag.Trade = StaticData.GetTrade();
         if (ModelState.IsValid)
         {
             if (placementTable.ID > 0)
             {
                 placementTableRepository.UpdatePlacement(placementTable);
             }
             else
             {
                 placementTableRepository.InsertPlacement(placementTable);
             }
         }
         else
         {
             return(View(placementTableModel));
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception)
     {
         return(View(placementTableModel));
     }
 }
 public PlacementTable UpdatePlacement(PlacementTable placementTable)
 {
     iTIDataEntities.Entry(placementTable).State = EntityState.Modified;
     iTIDataEntities.SaveChanges();
     return(placementTable);
 }