Check when the user doesn't have any location in database
This commit is contained in:
parent
db4403b75c
commit
ed97efaf61
@ -7,12 +7,12 @@
|
|||||||
using AspNetCore.Mvc;
|
using AspNetCore.Mvc;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Catalog.API.ViewModel;
|
|
||||||
using Model;
|
using Model;
|
||||||
using EntityFrameworkCore;
|
using EntityFrameworkCore;
|
||||||
using Dto;
|
using Dto;
|
||||||
using AspNetCore.Authorization;
|
using AspNetCore.Authorization;
|
||||||
using Extensions.Options;
|
using Extensions.Options;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel;
|
||||||
|
|
||||||
[Route("api/v1/[controller]")]
|
[Route("api/v1/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -129,13 +129,10 @@
|
|||||||
{
|
{
|
||||||
var marketingData = await _marketingDataRepository.GetAsync(userId.ToString());
|
var marketingData = await _marketingDataRepository.GetAsync(userId.ToString());
|
||||||
|
|
||||||
if (marketingData is null)
|
|
||||||
{
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var campaignDtoList = new List<CampaignDTO>();
|
var campaignDtoList = new List<CampaignDTO>();
|
||||||
|
|
||||||
|
if (marketingData != null)
|
||||||
|
{
|
||||||
//Get User Location Campaign
|
//Get User Location Campaign
|
||||||
foreach (var userLocation in marketingData.Locations)
|
foreach (var userLocation in marketingData.Locations)
|
||||||
{
|
{
|
||||||
@ -154,6 +151,7 @@
|
|||||||
campaignDtoList.AddRange(userCampaignDtoList);
|
campaignDtoList.AddRange(userCampaignDtoList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var totalItems = campaignDtoList.Count();
|
var totalItems = campaignDtoList.Count();
|
||||||
campaignDtoList = campaignDtoList
|
campaignDtoList = campaignDtoList
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel
|
namespace Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel
|
||||||
{
|
{
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
public class PaginatedItemsViewModel<TEntity> where TEntity : class
|
public class PaginatedItemsViewModel<TEntity> where TEntity : class
|
||||||
{
|
{
|
||||||
public int PageIndex { get; private set; }
|
public int PageIndex { get; private set; }
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
|
||||||
using WebMVC.ViewModels;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
||||||
{
|
{
|
||||||
using AspNetCore.Authorization;
|
using AspNetCore.Authorization;
|
||||||
@ -10,6 +7,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System;
|
using System;
|
||||||
using ViewModels.Pagination;
|
using ViewModels.Pagination;
|
||||||
|
using global::WebMVC.ViewModels;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class CampaignsController : Controller
|
public class CampaignsController : Controller
|
||||||
|
Loading…
x
Reference in New Issue
Block a user