public ActionResult Edit([Bind(Include = "Portfolio_Type_Id,Portfolio_Type_Name")] PortfolioTypeTO portfolio_Type) { if (portfolio_Type.Portfolio_Type_Name != "" || portfolio_Type.Portfolio_Type_Name != null) { ptfTypeRepo.updatePortfolioType(portfolio_Type); return(RedirectToAction("Index")); } return(View(portfolio_Type)); }
public void updatePortfolioType(PortfolioTypeTO portfoliotype) { Portfolio_Type dataToUpdate = db.Portfolio_Type.Where(x => x.Portfolio_Type_Id == portfoliotype.Portfolio_Type_Id).FirstOrDefault(); dataToUpdate.Portfolio_Type_Name = portfoliotype.Portfolio_Type_Name; dataToUpdate.IsActive = portfoliotype.IsActive; db.SaveChanges(); }
public void savePortfolioType(PortfolioTypeTO portfoliotype) { Portfolio_Type dataToSave = new Portfolio_Type() { Portfolio_Type_Id = portfoliotype.Portfolio_Type_Id, Portfolio_Type_Name = portfoliotype.Portfolio_Type_Name, IsActive = true }; db.Portfolio_Type.Add(dataToSave); db.SaveChanges(); }
// GET: PortfolioType/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PortfolioTypeTO portfolio_Type = ptfTypeRepo.getPortfolioTypebyId(id); if (portfolio_Type == null) { return(HttpNotFound()); } return(View(portfolio_Type)); }