/// <summary> /// Methode called when user generate and Index_QR entity, /// It takes the ProuctID and COntroller and action name those are passed by the view /// looks for its entities in the DB and create a new Index_QR entity with /// composed of those entites and also includes the User entity who was logged in /// </summary> /// <param name="productID">Product of ID to generate</param> /// <param name="controllerName">Name of controller, so the ID can be found</param> /// <param name="actionName">Name of the action, so the ID can be found</param> /// <returns>In case of insert query success it return the same page with the new generated QR /// in case of fail it return an error page</returns> public ActionResult Create(long productID, string controllerName, string actionName) { try { Controller_QR controller_QR = _unityOfWork.Controller_QR.GetAll().FirstOrDefault(b => b.Name == controllerName); Action_QR action_QR = _unityOfWork.Action_QR.GetAll().FirstOrDefault(b => b.Name == actionName); Product Product = _unityOfWork.Product.GetById(productID); Index_QR model = new Index_QR() { Product = Product, Controller_QR = controller_QR, Action_QR = action_QR, //ProductID = productID, // ControllerID = controller_QR.ID, UserID = User.FindFirst(ClaimTypes.NameIdentifier).Value, Created = DateTime.Now, IsActive = true }; _unityOfWork.Index_QR.Insert(model); _unityOfWork.Save(); return(RedirectToAction("Detail", "Product", new { id = productID })); } catch { return(RedirectToAction("Error", "Home")); } }
public void Delete(Action_QR action_QR) { throw new NotImplementedException(); }
public void Insert(Action_QR action_QR) { throw new NotImplementedException(); }