public ActionResult AddShelf(ShelfModel shelf) { try { if (ModelState.IsValid) { ShelfRepository ShelfRepo = new ShelfRepository(); ShelfRepo.AddShelf(shelf); var profileData = this.Session["UserProfile"] as UserSession; LogModel logModel = new LogModel() { UserId = profileData.UserID, TableName = "Shelf", Activity = "Added Shelf", LogDate = DateTime.Now }; logRepository logRepository = new logRepository(); logRepository.AddLog(logModel); } return(RedirectToAction("GetAllShelfDetails")); } catch { return(RedirectToAction("GetAllShelfDetails")); } }