public ActionResult viewRoutineWorkout(routineModel _viewRoutine) { if ((int)Session["FK_roleID"] == 1 || (int)Session["FK_roleID"] == 2 || (int)Session["FK_roleID"] == 3) { try { // setting personID to the session varibale personID int _personID = (int)Session["personID"]; // showing routineID in url // setting routineID to the view routine routineID int _routineID = _viewRoutine.routineID; // making new instance of the view model viewModel viewRoutineW = new viewModel(); // populating routine workout list from the batabase that matches personID and routineID viewRoutineW.routineWorkoutList = _mapper.map(_routineWorkoutDataAccess.listAllRoutineWorkout(_personID, _routineID)); // setting session variable FK_routineWorkoutID to view routine. routineID Session["FK_routineWorkoutID"] = _viewRoutine.routineID; // return back view with view routine Workout return(View(viewRoutineW)); } catch (Exception _error) { // putting error into a file _logger.logError(_error); } } // return error page return(View("Error")); }
public ActionResult viewPerson() { try { // checking if the role id is 2 or 3 to view the memebers if ((int)Session["FK_roleID"] == 2 || (int)Session["FK_roleID"] == 3) { // making new insatance of view model called person view viewModel personView = new viewModel(); // getting access to the database to list all the members personView.personList = _mapper.map(_personDataAccess.listAllPerson()); // storing the person list into the role list in preson view model personView.roleList = _mapper.map(_personDataAccess.listAllRoles()); Session["viewRoles"] = personView.roleList; return(View(personView)); } } catch (Exception _error) { // putting error into a file _logger.logError(_error); } return(View("Error")); }
public ActionResult editAuthor(string firstName, string lastName, int birthYear, int aID) { Author _authObj = new Author(); _authObj.FirstName = firstName; _authObj.LastName = lastName; _authObj.BirthYear = birthYear; _authObj.Aid = aID; ///// if (true) { Author.editAuthor(_authObj); return(View("authors", Author.getAuthorList().ToPagedList(1, 15))); } else { viewModel vmodel = new viewModel(); vmodel.author = _authObj; if (ModelState.IsValid) { ViewBag.ErrorDan = "Incorrect input"; } else { ViewBag.ErrorWar = "Not a valid input"; } return(View("editAuthor", vmodel)); } }
public ActionResult GuardarPregunta(tbl_pregunta soru, tbl_opcion secenek) { mesajViewModel mesajModel = new mesajViewModel(); if (!ModelState.IsValid) { var model_ = new viewModel() { Kategori = db.tbl_categoria.ToList(), Soru = new tbl_pregunta(), Secenek = new tbl_opcion() }; return(View("QuizOlustur", model_)); } else { soru.preguntaUniq = Guid.NewGuid(); secenek.preguntaUniq = soru.preguntaUniq; soru.descripcion = 0; db.tbl_pregunta.Add(soru); db.tbl_opcion.Add(secenek); } db.SaveChanges(); mesajModel.Mesaj = "Pregunta Agregada"; mesajModel.Status = 1; mesajModel.LinkText = "Añadir otra pregunta"; mesajModel.Url = "/ExamenPreparar/CrearCuestionario"; return(View("_mesaj", mesajModel)); }
public ActionResult SoruKaydet(q_soru soru, q_secenek secenek) { mesajViewModel mesajModel = new mesajViewModel(); if (!ModelState.IsValid) { var model_ = new viewModel() { Kategori = db.q_kategori.ToList(), Soru = new q_soru(), Secenek = new q_secenek() }; return(View("QuizOlustur", model_)); } else { soru.soruUniq = Guid.NewGuid(); secenek.soruUniq = soru.soruUniq; soru.derece = 0; db.q_soru.Add(soru); db.q_secenek.Add(secenek); } db.SaveChanges(); mesajModel.Mesaj = "Soru Başarıyla Eklendi..."; mesajModel.Status = 1; mesajModel.LinkText = "Yeni Soru Ekle"; mesajModel.Url = "/QuizHazirla/QuizOlustur"; return(View("_mesaj", mesajModel)); }
public ActionResult addRoutineWorkoutG() { if ((int)Session["FK_roleID"] == 1 || (int)Session["FK_roleID"] == 2 || (int)Session["FK_roleID"] == 3) { try { // making new instance of the view model viewModel viewExercise = new viewModel(); // using the database of all exercise and adding back to exercise list viewExercise.exerciseList = _mapper.map(_exerciseData.listAllExercise()); viewExercise.bodyPartList = _mapper.map(_bodyPartData.listAllBodyPart()); // making new instance of routineWorkout model routineWorkoutModel routineWorkoutModel = new routineWorkoutModel(); // populating the routineWorkoutmodel exercise list with view model exercise listt routineWorkoutModel.exerciseList = viewExercise.exerciseList; routineWorkoutModel.bodyPartList = viewExercise.bodyPartList; // setting variable view exercise to the routine workout model exercise list Session["viewExercise"] = routineWorkoutModel.exerciseList; Session["viewBodyPart"] = routineWorkoutModel.bodyPartList; // return the view with routine workout model return(View(routineWorkoutModel)); } catch (Exception _error) { // putting error into a file _logger.logError(_error); } } return(View("Error")); }
public ActionResult editAuthor(string firstName, string lastName, int?birthYear, int?aID) { if (Account.testConn()) { viewModel _viewModel = new viewModel(); Author _authObj = new Author(); _authObj.FirstName = firstName; _authObj.LastName = lastName; _authObj.BirthYear = (int?)birthYear; _authObj.Aid = aID ?? default(int); if (ModelState.IsValid) //Validator.TryValidateObject(_authObj, context, result, true)) { Author.editAuthor(_authObj); } else { return(View("editAuthor", _viewModel)); } return(View("authors", Author.getAuthorList().ToPagedList(1, 15))); } ViewBag.serverError = "No connection to database"; return(View("authors")); }
public viewaddressBook(viewModel _viewModel, model.model _model) { this._model = _model; this._viewModel = _viewModel; _viewModel.addressbook = this; _model.addressbook = laddressBook; }
public ActionResult ResultsbyCategories(int id) { viewModel vm_ = new viewModel(); vm_.Votings = db.Voting.Where(m => m.VCategoryID == id).ToList();; vm_.Categories = db.Category.ToList(); return(View(vm_)); }
public IActionResult GetCompliances() { _logger.LogInformation($"Serilog Setting: {_serilogSettings.LoggingEndpoint}"); var vm = new viewModel(); var complianceList = vm.PopulateData().ToList(); return(Ok(complianceList)); }
public viewmemorandum(viewModel _viewModel, model.model _model) { this._model = _model; this._viewModel = _viewModel; _viewModel.memorandum = this; _model.memorandum = lmemorandum; }
public viewdiary(viewModel _viewModel, model.model _model) { this._model = _model; this._viewModel = _viewModel; _viewModel.diary = this; _model.diary = ldiary; }
public MyAddinControl() { //El datacontext es el viewmodel, el viewmodel se comunica con todas las otras clases vm = new viewModel(); this.DataContext = vm; vm.initVM(); InitializeComponent(); }
public ActionResult Results() { viewModel vm_ = new viewModel(); vm_.Votings = db.Voting.ToList(); vm_.Categories = db.Category.ToList(); return(View(vm_)); }
public WorkerHandler( viewModel viewModel, SearchItemWorker searchItemFetcher, RefreshTradePileWorker checkTradePileWorker ) { ViewModel = viewModel; SearchItemFetcher = searchItemFetcher; CheckTradePileWorker = checkTradePileWorker; }
public ActionResult meiri() { using (WangYouBKEntities db = new WangYouBKEntities()) { IEnumerable <WenZhang> wz = db.WenZhang.ToList(); viewModel models = new viewModel(); ViewBag.wenzhangTypeID = new SelectList(db.WanZhangType, "WenZhangTypeID", "WenZhangTypeNmae"); return(View(models)); } }
public viewproperty(viewModel _viewModel, model.model _model) { this._model = _model; this._viewModel = _viewModel; _viewModel.property = this; _model.property = lproperty; lproperty.CollectionChanged += Lproperty_CollectionChanged; }
public void Test_SetWorkingHours() { //Arrange section start // initializing hours Hour[] Monday = new Hour[] { }; Hour[] Tuesday = new Hour[] { new Hour { type = "open", value = 36000 }, new Hour { type = "close", value = 64800 } }; Hour[] Wednesday = new Hour[] { }; Hour[] Thursday = new Hour[] { new Hour { type = "open", value = 36000 }, new Hour { type = "close", value = 64800 } }; Hour[] Friday = new Hour[] { new Hour { type = "open", value = 36000 } }; Hour[] Saturday = new Hour[] { new Hour { type = "close", value = 36000 }, new Hour { type = "open", value = 36000 } }; Hour[] Sunday = new Hour[] { new Hour { type = "close", value = 36000 }, new Hour { type = "open", value = 43200 }, new Hour { type = "open", value = 756000 } }; // asigning it to week var week input = new week(); input.Monday = Monday; input.Tuesday = Tuesday; input.wednesday = Wednesday; input.Thursday = Thursday; input.Friday = Friday; input.Saturday = Saturday; input.Sunday = Sunday; // Expected viewModel expectation = new viewModel(); expectation.Monday = "Closed"; expectation.Tuesday = "11:00 am - 7:00 pm"; expectation.wednesday = "Closed"; expectation.Thursday = "11:00 am - 7:00 pm"; expectation.Friday = "11:00 am"; expectation.Saturday = "2:00 am - 11:00 am"; expectation.Sunday = "2:00 am - 1:00 pm - 10:00 pm"; //Arrange section Ended //Act Section }
public AppControl(SldWorks swapp, viewModel vmodel) { //instancia actual de solidworks swApp = (SldWorks)swapp; //Instanciar un listener de selecciones selListener = new SelectionListener(swApp); //Instanciar el controlador para xbox xBoxConInstance = new xBoxControllerCom(); //Inicializar Mate Manipulator mateM = new MateManipulator(this); }
// GET: ExamenPreparar public ActionResult CrearCuestionario() { var model = new viewModel() { Kategori = db.tbl_categoria.ToList(), Soru = new tbl_pregunta(), Secenek = new tbl_opcion() }; return(View("CrearCuestionario", model)); }
// // GET: /Home/ public ActionResult Index() { var name = User.Identity.Name;//获取cookin ViewBag.name = name; using (WangYouBKEntities db = new WangYouBKEntities()) { IEnumerable <WenZhang> wz = db.WenZhang.ToList(); viewModel models = new viewModel(); return(View(models)); } }
//Quiz hazırlama ekranı public ActionResult QuizOlustur() { var model = new viewModel() { Kategori = db.q_kategori.ToList(), Soru = new q_soru(), Secenek = new q_secenek() }; return(View("QuizOlustur", model)); }
public ActionResult createBook() { viewModel _viewModel = new viewModel(); if (Account.testConn()) { _viewModel.authorList = Author.getAuthorList(); _viewModel.classificationList = Classification.getClassificationList(); return(View("createBook", _viewModel)); } ViewBag.serverError = "No connection to database"; return(View("createBook", _viewModel)); }
// GET: Books public ActionResult books(int?page) { viewModel _viewModel = new viewModel(); if (Account.testConn()) { _viewModel.bookList = Books.getBookList(); return(View(Books.getBookList().ToPagedList(page ?? 1, 15))); } List <Books> _emptyList = new List <Books>(); ViewBag.serverError = "No connection to database"; return(View("books", _emptyList.ToPagedList(page ?? 1, 15))); }
public ActionResult editAuthor(int aID) { viewModel _viewModel = new viewModel(); if (Account.testConn()) { _viewModel.authorList = Author.getAuthorList(); _viewModel.author = Author.getAuthor(aID); return(View("editAuthor", _viewModel)); } ViewBag.serverError = "No connection to database"; return(View("authors", _viewModel)); }
public ActionResult myAction() { bool switch; viewModel vm = new viewModel(); if (switch) { vm.Src = "something.jpg"; } else { vm.Src = "somthingelse.jpg"; } return(View(vm)); }
public ActionResult bookDetails(string isbn) { viewModel _viewModel = new viewModel(); if (Account.testConn()) { _viewModel.authorList = Books.getBookAuthor(isbn); _viewModel.book = Books.getBook(isbn); // _viewModel.book. return(View(_viewModel)); } ViewBag.serverError = "No connection to database"; return(View("books", _viewModel)); }
public ActionResult editBook(string isbn) { viewModel _viewModel = new viewModel(); if (Account.testConn()) { _viewModel.book = Books.getBook(isbn); _viewModel.authorList = Author.getAuthorList(); _viewModel.classificationList = Classification.getClassificationList(); return(View("editBook", _viewModel)); } ViewBag.serverError = "No connection to database"; return(View("books", _viewModel)); }
private string UploadedFile(viewModel model) { string uniqueFileName = null; if (model.Photo != null) { string uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "images"); uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Photo.FileName; string filePath = Path.Combine(uploadsFolder, uniqueFileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { model.Photo.CopyTo(fileStream); } } return(uniqueFileName); }
// // GET: /Info/ public ActionResult Info(int?id) { using (WangYouBKEntities db = new WangYouBKEntities()) { IEnumerable <WenZhang> wz = db.WenZhang.ToList(); viewModel models = new viewModel(); var wenz = db.WenZhang.Find(id); ViewBag.wenzhangBiaoTI = wenz.wenzhangBiaoTI; ViewBag.wenzhangHTML = wenz.wenzhangHTML; ViewBag.wenzhangDateTime = wenz.wenzhangDateTime; ViewBag.wenzhangid = id; return(View(models)); } }
base.SetViewModel(viewModel);