public ActionResult Detail(DetailModel m) { if (m.DeleteTransactionID.HasValue) { Transaction delTrans = DC.Transactions.Where(a => a.ID == m.DeleteTransactionID).FirstOrDefault(); if (delTrans != null) { DC.Transactions.DeleteOnSubmit(delTrans); DC.SubmitChanges(); } } else { Transaction newTrans = new Transaction { ID = Guid.NewGuid(), WalletID = m.WalletID, Type = m.Type, Date = m.Date, Title = m.Title, Note = m.Note, Value = decimal.Parse(m.Value), CategoryID = m.CategoryID }; DC.Transactions.InsertOnSubmit(newTrans); DC.SubmitChanges(); } return(RedirectToAction("Detail", new { walletID = m.WalletID })); }
private bool TryChargerDetailDepuisBDD(int idLivre, out DetailModel detailModel) { using (SqlConnection connection = new SqlConnection(@"Server=.\SQLExpress;Database=ListeLecture;Integrated Security=true")) { connection.Open(); SqlCommand command = new SqlCommand( "SELECT Titre, Auteur, Note, DateDebutLecture, DateFinLecture FROM Livre WHERE ID = @idLivre", connection); command.Parameters.AddWithValue("@idLivre", idLivre); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { string titre = (string)reader["Titre"]; string auteur = (string)reader["Auteur"]; short note = (Byte)reader["Note"]; DateTime dateDebutLecture = (DateTime)reader["DateDebutLecture"]; DateTime dateFinLecture = (DateTime)reader["DateFinLecture"]; detailModel = new DetailModel(titre, auteur, dateDebutLecture, dateFinLecture, note); return(true); } else { detailModel = null; return(false); } } }
public ActionResult Detail(string parkCode, string tempType) { /*Wanted to have a default Park Code for if the user attempts to reach this page without * going through Park List*/ if (parkCode == null) { parkCode = "ENP"; } /*This sets the temp choice as a Session value in order to persist for future View calls*/ if (tempType == null) { tempType = Session["tempChoice"] as string; } //Persistence of temperature choice demonstrated below Session["tempChoice"] = tempType; //Database call to receive 5-Day Forecast List <WeatherReport> weatherReports = _dal.GetWeatherReports(parkCode, tempType); NationalPark park = _dal.GetOnePark(parkCode); DetailModel model = new DetailModel { NationalPark = park, WeatherReports = weatherReports }; return(View("Detail", model)); }
/// <summary> /// Opens the detail page for a wallet /// </summary> /// <param name="walletID">WalletID</param> /// <returns>Detail View</returns> public ActionResult Detail(Guid walletID) { if (!TsumugiUser.IsLoggedOn) { return(RedirectToAction("Dashboard", "Dashboard")); } DetailModel m = new DetailModel { DC = DC, WalletID = walletID, TransactionList = DC.Transactions.Where(a => a.WalletID == walletID).OrderByDescending(b => b.Date).Select(c => new TransactionListItem(c)).ToList() }; List <SelectListItem> options = DC.Categories.Select(a => new SelectListItem { Value = a.ID.ToString(), Text = a.Name }).ToList(); options.Add(new SelectListItem { Value = "", Text = "-" }); m.CategoryOptions = new SelectList(options, "Value", "Text"); List <Transaction> calcList = DC.Transactions.Where(a => a.WalletID == walletID).ToList(); m.MonthlyEarnings = Chart.CalcEarnings(DateTime.Now.Month, calcList); m.MonthlySpendings = Chart.CalcSpendings(DateTime.Now.Month, calcList); m.Trend = Chart.CalcTrend(DateTime.Now.Month, calcList); return(View(m)); }
public void GetCurrent() { if (currModel.Id == 0) { currModel = listModel.Find(m => m.Id == id); } if (currModel == null) { currModel = new DetailModel(); throw new Exception("参数[Id]无效!"); } int currIndex = listModel.IndexOf(listModel.Find(m => m.Id == currModel.Id)); if (currIndex == 0) { previousModel = new DetailModel(); } else { previousModel = listModel[currIndex - 1]; } if (currIndex == listModel.Count() - 1) { nextModel = new DetailModel(); } else { nextModel = listModel[currIndex + 1]; } }
public ActionResult Detail(DetailModel model) { if (model.ActionMode != "Delete" && this.ModelState.IsValid) //如果資料驗證成功 { switch (model.ActionMode) { case "Add": model.InsertStudent(); break; case "Update": model.UpdateStudent(); break; case "Delete": model.DeleteStudent(); break; } return(RedirectToAction("SearchList")); } else { //失敗訊息 ViewBag.ResultMessage = "資料有誤,請檢查"; return(View(model)); } }
// (Detail Page) Selects a single record from the Models table. // GET: /Model/Detail/id public async Task <IActionResult> Detail(int?id) { ViewData["Title"] = "Models | Detail | "; try { if (id.HasValue) { Model model = await modelService.GetModelAsync(id); DetailModel detailModel = new DetailModel { ModelDetail = mapper.Map <VehicleModelVM>(model), MakeDetail = mapper.Map <VehicleMakeVM>(await modelService.GetMakeAsync(model.MakeId)), Id = model.Id, Abrv = model.Abrv, MakeId = model.MakeId }; return(View(detailModel)); } else { return(BadRequest("The ID isn't valid")); } } catch (Exception) { return(BadRequest("Something went wrong")); } }
/// <summary> /// 加载右侧档案与分类列表数据 /// </summary> /// <param name="userId">用户id</param> /// <returns>文章详情页模型</returns> private T LoadRightMenusData <T>(long userId) where T : class, new() { if (typeof(T) == typeof(DetailModel)) { var model = new DetailModel(); // 随笔档案 model.Archives = articleService.GetArchivesByUserId <Archives>(userId); // 随笔分类 model.CustomCategories = articleService.GetCustomCategoriesByUserId <CustomCategories>(userId); return(model as T); } else if (typeof(T) == typeof(BlogsModel)) { var model = new BlogsModel(); // 随笔档案 model.Archives = articleService.GetArchivesByUserId <Archives>(userId); // 随笔分类 model.CustomCategories = articleService.GetCustomCategoriesByUserId <CustomCategories>(userId); return(model as T); } else { return(null); } }
public int CreateDetail(DetailModel detail) { using (var service = new DetailController()) { return(service.Create(detail.GetData())); } }
public void UpdateDetail(DetailModel detail) { using (var service = new DetailController()) { service.Update(detail.GetData()); } }
public IActionResult CreateDetail(DetailModel model) { try { var repo = _uow.GetService <InvoiceDetailDomains>(); var newDetail = new InvoiceDetails { IdPro = model.IdPro, IdInvoice = model.IdInvoide, Quantity = model.Quantity, Total = model.Total, }; repo.Create(newDetail); _uow.SaveChanges(); return(Ok()); } catch (Exception ex) { return(BadRequest(new ApiResult() { Code = 400, Detail = ex.Message })); } }
public DetailModel Detail(Guid roleId, Guid languageId) { var result = new DetailModel(); var businessModel = _roleManager.Detail(roleId); var item = businessModel.Item; if (item == null) { throw new NotFoundException(Messages.DangerRecordNotFound); } var itemLanguageLine = item.RoleLanguageLines.FirstOrDefault(x => x.Role.Id == roleId && x.Language.Id == languageId); if (itemLanguageLine == null) { throw new NotFoundException(Messages.DangerRecordNotFound); } result.RoleId = item.Id; result.RoleCode = item.RoleCode; result.RoleName = itemLanguageLine.RoleName; result.RoleDescription = itemLanguageLine.RoleDescription; result.LanguageCode = itemLanguageLine.Language.LanguageCode; result.LanguageName = itemLanguageLine.Language.LanguageName; result.DisplayOrder = item.DisplayOrder; result.IsApproved = item.IsApproved; result.CreateDate = businessModel.CreateDate; result.CreatedBy = businessModel.CreatedBy.DisplayName; result.UpdateDate = businessModel.UpdateDate; result.UpdatedBy = businessModel.UpdatedBy.DisplayName; return(result); }
public ActionResult CheckBeforeSave(DetailModel model) { var response = iRstSrvClient.Get().BookingDetailsSet_Check_00_00_003(Common.RestaurantID, model.LocationID, model.BookingID, model.TableID, model.BookingDate, model.StartTime, model.SittingTime, Common.Token); if (Utils.CheckAPIResponse(response)) { var startTime = string.Empty; var endTime = string.Empty; if (response.IsSucceed == 1) { startTime = response.NewStartTime.Substring(0, response.NewStartTime.LastIndexOf(":")); endTime = response.NewEndTime.Substring(0, response.NewEndTime.LastIndexOf(":")); } return(Json(new { IsSucceed = true, StartTime = startTime, EndTime = endTime, Code = response.IsSucceed })); } else { return(Json(Common.JsonFail)); } }
// http://holoxplor.ddrit.com/HoloTable/Rating/sample/00fa8108-001c-bff0-0000-000000000000 // http://holoxplor.ddrit.com/HoloTable/Rating/sample/ANVL_Hornet_F7CM public ActionResult Rating(String id, String shipID) { Guid shipGuid = Guid.Empty; ShipLoadout loadout; if (Guid.TryParse(shipID, out shipGuid)) { HoloTableController._lockMap[id] = HoloTableController._lockMap.GetValue(id, new Object()); lock (HoloTableController._lockMap[id]) { DetailModel model = new DetailModel(id, shipGuid); loadout = new ShipLoadout(model); } } else { loadout = new ShipLoadout(id); } return(new ContentResult { Content = loadout.ToJSON(), ContentType = "application/json" }); }
public async Task <IActionResult> UpdateDetail(DetailModel model) { if (ModelState.IsValid) { string userId = HttpContext.GetUserInfoFromSession("user_id"); User user = await userManager.FindByIdAsync(userId); user.Name = model.Name; user.UserName = model.Username; user.Surname = model.Surname; if (model.Email != user.Email) { user.EmailConfirmed = false; } user.Email = model.Email; user.NormalizedEmail = model.Email.ToUpper(); user.PhoneNumber = model.Phone; await db.SaveChangesAsync(); return(RedirectToAction(nameof(Detail))); } else { ModelState.AddModelError("", "Something went wrong.Fill all required blanks."); return(RedirectToAction(nameof(Detail))); } }
/// <summary> /// Update chosen Task /// </summary> /// <param name="detail"></param> /// <param name="id"></param> /// <returns></returns> public IHttpActionResult Put([FromBody] DetailModel detail, int id) { try { if (TimeKeeperUnit.Details.Get(id) == null) { Logger.Log($"No such task with id {id}", "ERROR"); return NotFound(); } if (!ModelState.IsValid) { string message = $"Failed updating task with id {id}, " + Environment.NewLine; message += string.Join(Environment.NewLine, ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage)); throw new Exception(message); } TimeKeeperUnit.Details.Update(TimeKeeperFactory.Create(detail, TimeKeeperUnit), id); TimeKeeperUnit.Save(); Logger.Log($"Updated task with id {id}", "INFO"); return Ok(detail); } catch (Exception ex) { Logger.Log(ex.Message, "ERROR", ex); return BadRequest(ex.Message); } }
private void update_btn_Click(object sender, EventArgs e) { PhotoModel updatePhoto = new PhotoModel() { Name = nameEditTextBox.Text, Location = locationEditTextBox.Text }; EventModel updatedEvent = new EventModel() { Name = eventEditTextBox.Text, IdPhoto = ViewDetailForm.editedPhoto.Id }; PeopleModel peopleUpdate = new PeopleModel() { Name = peoplesEditTextBox.Text, IdPhoto = ViewDetailForm.editedPhoto.Id }; DetailModel detailUpdate = new DetailModel() { DetailKey = keyDetailEdit.Text, DetailValue = valueEdit.Text, IdPhoto = ViewDetailForm.editedPhoto.Id }; client.UpdatePhoto(updatePhoto); client.UpdateEvent(updatedEvent); client.UpdatePeople(peopleUpdate); client.UpdateDetail(detailUpdate); MessageBox.Show("Updated successfully!"); }
public ActionResult Details(string dmstype, string name) { string cabinetId = _userService.GetCurrentCabinetId(); if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(dmstype) && !string.IsNullOrEmpty(cabinetId)) { var isFolder = dmstype.ToUpper().Trim() == "FOLDER" ? true : false; string username = User.Identity.GetUserId(); var dokIndexs = _dokmeeService.GetCabinetIndexes(username, cabinetId).ToList(); IEnumerable <DokmeeFilesystem> dokmeeFilesystems = _dokmeeService.GetDokmeeFilesystems(username, name, isFolder, cabinetId); DetailModel model = new DetailModel() { FolderName = name, CabinetId = cabinetId, TableTitles = _mapper.Map <List <DocumentIndex> >(dokIndexs), DocumentItems = _mapper.Map <List <DocumentItem> >(dokmeeFilesystems).Where(t => !t.IsInRecycleBin).ToList() }; model.TableTitles = model.TableTitles.OrderBy(t => t.Order).ToList(); ViewBag.cabinetId = cabinetId; return(View(model)); } else { return(View()); } }
public async Task <ActionResult> Details(Guid profileId, Guid certificationId) { var model = new DetailModel(); var profile = await this._certificationProfilesProvider.GetCertificationProfileAsync(profileId, default); if (profile == null) { return(RedirectToAction("Index", "CertificationProfiles")); } var certification = profile.Certifications.FirstOrDefault(c => c.Id == certificationId); if (certification == null) { return(RedirectToAction("Details", "CertificationProfiles", new { id = profileId })); } model.CertificationId = certification.Id; model.CertificationName = certification.Name; model.CredentialId = certification.CredentialId; model.CredentialUrl = certification.CredentialUrl; model.ExpirationDate = certification.ExpirationDate; model.IssueDate = certification.IssueDate; model.IssuingOrganization = certification.IssuingOrganization; model.ProfileId = profile.Id; model.LastName = profile.LastName; model.FirstName = profile.FirstName; model.Email = profile.Email; return(View(model)); }
public ActionResult Details(int?id) { var asset = assets.GetById(id); var model = new DetailModel { Id = asset.Id, Title = asset.Title, Author = assets.GetAuthor(asset.Id), Country = asset.Country, Language = asset.Language, Description = asset.Description, Frequency = assets.GetFrequency(asset.Id), GenreOrCategory = asset.GenreOrCategory, ImageUrl = asset.ImageUrl, ISBN = assets.GetISBN(asset.Id), NumberOfCopies = asset.NumbersOfCopies, Pages = assets.GetPages(asset.Id), Publisher = asset.Publisher, Type = assets.GetType(asset.Id), Year = asset.Year, Price = asset.Price }; return(View(model)); }
public ActionResult Detail(int projectId, int storyId) { if (string.IsNullOrEmpty(CurrentUserName)) { return(RedirectToAction("Index", "Home")); } var game = _games.Get(projectId, storyId); EnsurePlayerExists(game, CurrentUserName); var project = _pivotal.GetProject(projectId); var pointScaleOptions = project.PointScale.Split(',').Select(n => int.Parse(n)); var story = _pivotal.GetStory(projectId, storyId); _pivotal.LoadTasks(story); _pivotal.LoadNotes(story); var model = new DetailModel { Story = story, PointScaleOptions = pointScaleOptions }; return(View(model)); }
public ActionResult Save(DetailModel model) { JsonResultModel result = new JsonResultModel(); try { Validate validate = new Validate(); validate.CheckObjectArgument <DetailModel>("model", model); if (validate.IsFailed) { result.BuilderErrorMessage(validate.ErrorMessages); return(Json(result)); } model.PostValidate(ref validate); if (validate.IsFailed) { result.BuilderErrorMessage(validate.ErrorMessages); return(Json(result)); } this.saleOrderService.Update(model.Id, model.Status, model.ActualAmount, this.Session["Mobile"].ToString()); result.Result = true; } catch (Exception ex) { result.BuilderErrorMessage(ex.Message); } return(Json(result)); }
public SignupDetaiPage1ViewModel() { User = new DetailModel(); OnValidationCommand = new Command((obj) => { User.FirstName.NotValidMessageError = "Name is required"; User.FirstName.IsNotValid = string.IsNullOrEmpty(User.FirstName.Name); User.Email.NotValidMessageError = "Email is required"; User.Email.IsNotValid = string.IsNullOrEmpty(User.Email.Name); if (string.IsNullOrEmpty(User.MiddleName.Name)) { User.MiddleName.NotValidMessageError = "Middlename is required"; User.MiddleName.IsNotValid = true; } if (string.IsNullOrEmpty(User.SurName.Name)) { User.SurName.NotValidMessageError = "Surname is required"; User.SurName.IsNotValid = true; } }); }
private static void WebApiTest() { DetailModel model = new DetailModel(); model.TotalNoofPassenger = 5; model.NoofPassengerarrived = 10; model.NoofPassengerDeparted = 5; model.FromBuilding = "1"; model.ToBuilding = "5"; model.DateofJourney = "02/26/2014"; var request = HttpWebRequest.Create(string.Format(@"http://localhost:3381/api/Values")); request.ContentType = "application/json"; request.Method = "POST"; request.ContentType = "application/json"; string data = JsonConvert.SerializeObject(model); using (var streamWriter = new StreamWriter(request.GetRequestStream())) { streamWriter.Write(data); streamWriter.Flush(); } //request.r using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode == HttpStatusCode.Created) { string strTest = "You are successful"; } } //IDroidTracker tracker = new DroidTrackerDetails(); //tracker.AddToDb(model); }
public CarModel GetCarDetailsById(int id) { var car = (from carObj in GetAll() where carObj.Id == id select new CarModel { Id = carObj.Id, Model = carObj.Model }).FirstOrDefault(); var allDetails = detailRepo.GetAll(); var details = from detailObj in allDetails where detailObj.CarId == id select detailObj; foreach (var i in details) { var detailModels = new DetailModel { Id = i.Id, CarId = i.CarId, DetailName = i.DetailName, Cost = i.Cost }; car.Details.Add(detailModels); } return(car); }
public void Details_Controller_Test_On_EditModel_With_Invalid_Model() { //Arrange Guid id = new Guid("f616cc8c-2223-4145-b7d0-232a1f6f0795"); string feedBackMessage = "TestT"; int noOfPages = 10; int rating = 10; DateTime checkIn = DateTime.Now; DateTime checkOut = DateTime.Now.AddDays(1); Detail expectaDetail = new Detail(checkIn, checkOut, feedBackMessage, noOfPages, rating); expectaDetail.Id = id; DetailModel expectedModel = new DetailModel(); expectedModel.FeedbackMessage = " "; var repo = Substitute.For <IRepository>(); var sut = new DetailsController(repo); repo.Update(expectaDetail); //Act sut.ModelState.AddModelError("FirstName", "Firstname Required"); var actual = sut.Edit(id, expectaDetail).Result; //Assert Assert.IsInstanceOfType(actual, typeof(ViewResult)); }
public ActionResult Detail(int id) { var model = new DetailModel(); model.hoSoUngVien = _hoSoUngVienService.GetById(id); return(View(model)); }
public ActionResult UnCheckedDetail(int UnCheckedAdminId) { //if (CurrentCustomer.CustomerType != Core.Domain.Customers.CustomerType.SuperAdmin) //{ // return new HttpUnauthorizedResult(); //} var adminUser = customerService.Get(e => e.Id == UnCheckedAdminId); int?orgIdnow = adminUser.OrganizationId; var organization = orgService.Get(s => s.Id == orgIdnow); var companyRegisterModel = new DetailModel() { CompanyID = organization.OrganizationNumber.ToString(), CompanyType = organization.OrganizationType.GetDescription(), CompanyName = organization.Name, Address = organization.OrganizationAddress, ZipCode = organization.ZipCode, CompanyPhone = organization.OrganizationTelephone, BusinessLicence = organization.BusinessLicence, UploadLicenceUri = organization.BusinessLicensePicUri, comId = organization.Id, AdminId = UnCheckedAdminId }; if (organization.OrganizationStatus != OrganizationStatus.Unaudited) { return(View("CheckedDetail", companyRegisterModel)); } return(View(companyRegisterModel)); }
public void DetailModelTest() { Guid testId = new Guid(); DateTime testStartDate = new DateTime(2000, 1, 1, 12, 0, 0); DateTime testEndDate = new DateTime(2000, 1, 1, 12, 50, 0); var model = new DetailModel() { Id = testId, CheckIn = testStartDate, CheckOut = testEndDate, FeedbackMessage = "feedback", NoOfPages = 5, Rating = 5 }; var result = TestModelHelper.Validate(model); Assert.AreEqual(0, result.Count); Assert.AreEqual(testId, model.Id); Assert.AreEqual(testStartDate, model.CheckIn); Assert.AreEqual(testEndDate, model.CheckOut); Assert.AreEqual("feedback", model.FeedbackMessage); Assert.AreEqual(5, model.NoOfPages); Assert.AreEqual(5, model.Rating); }
public ActionResult ChangeProductImage(string productId, string color, string sizeCategory) { //decode size category sizeCategory = sizeCategory.Replace("_amp_", "'"); var imgsModel = DetailManager.GetProductImageModelByColor(productId, color); var videoModel = DetailManager.GetProductVideoModel(productId); var sizesModel = DetailManager.GetSizesByColorAndSizeCategory(productId, color, sizeCategory); var detailModel = new DetailModel { ProductImages = imgsModel, ProductVideos = videoModel }; return(RenderMultipleViews(new List <RenderViewInfo>() { new RenderViewInfo() { ViewName = "zoomedView", ViewPath = "~/Views/Partials/Detail/_ZoomedImagePartial.cshtml", Model = imgsModel }, new RenderViewInfo() { ViewName = "imagesView", ViewPath = "~/Views/Partials/Detail/_ImagesPartial.cshtml", Model = detailModel }, new RenderViewInfo() { ViewName = "sizesView", ViewPath = "~/Views/Partials/Detail/_SizesPartial.cshtml", Model = sizesModel }, new RenderViewInfo() { ViewName = "shareView", ViewPath = "~/Views/Partials/Detail/_SocialSharePartial.cshtml", Model = imgsModel } })); }
public ActionResult Detail(int projectId, int storyId) { if (string.IsNullOrEmpty(CurrentUserName)) return RedirectToAction("Index", "Home"); var game = _games.Get(projectId, storyId); EnsurePlayerExists(game, CurrentUserName); var project = _pivotal.GetProject(projectId); var pointScaleOptions = project.PointScale.Split(',').Select(n => int.Parse(n)); var story = _pivotal.GetStory(projectId, storyId); _pivotal.LoadTasks(story); _pivotal.LoadNotes(story); var model = new DetailModel { Story = story, PointScaleOptions = pointScaleOptions }; return View(model); }