public AddCampaign(CampaignData campaignData) { NavigationPage.SetBackButtonTitle(this, ""); InitializeComponent(); BindingContext = _addCampaignViewModel = new AddCampaignViewModel(Navigation); _addCampaignViewModel.Initialize(campaignData); }
public AddCampaignView(CampaignModel model) { InitializeComponent(); DataContext = ViewModel = new AddCampaignViewModel(model); Owner = Application.Current.MainWindow; Loaded += OnAddCampaignViewLoaded; }
public async Task <IActionResult> AddCampaign(AddCampaignViewModel addCampaignViewModel) { if (ModelState.IsValid) { var currentUser = await userManager.GetUserAsync(HttpContext.User); var campaignId = await campaignService.AddCampaignAsync(addCampaignViewModel, currentUser); return(RedirectToAction(nameof(CampaignController.CampaignInfo), "Campaign", new { campaignId })); } return(View(addCampaignViewModel)); }
public async Task <long> AddCampaignAsync(AddCampaignViewModel addCampaignViewModel, User user) { var campaign = new Campaign { Description = addCampaignViewModel.Description, Title = addCampaignViewModel.Title, UserId = user.Id, ExpiryDate = SetExpiryDate(), Uri = user.Uri }; var result = await applicationContext.Campaigns.AddAsync(campaign); await applicationContext.SaveChangesAsync(); return(campaign.CampaignId); }
public IActionResult Add(AddCampaignViewModel addCampaignViewModel) { if (ModelState.IsValid) { Campaign newCampaign = new Campaign() { ID = addCampaignViewModel.ID, CampaignCode = addCampaignViewModel.CampaignCode, CampaignDescription = addCampaignViewModel.CampaignDescription, CampaignMonth = addCampaignViewModel.CampaignMonth, CampaignYear = addCampaignViewModel.CampaignYear }; context.Campaigns.Add(newCampaign); context.SaveChanges(); return(Redirect("/Campaign")); } return(View(addCampaignViewModel)); }
public IActionResult Add() { AddCampaignViewModel addCampaignViewModel = new AddCampaignViewModel(); return(View(addCampaignViewModel)); }