public ServiceResult Add(FootprintInput footprintInput) { var product = Resolve <IProductService>().GetSingle(u => u.Id == footprintInput.EntityId.ToInt64()); var productDetail = Resolve <IProductDetailService>() .GetSingle(u => u.ProductId == footprintInput.EntityId.ToInt64()); var image = productDetail.ImageJson.DeserializeJson <List <ProductThum> >(); var footprint = new Footprint { EntityId = footprintInput.EntityId, Name = product.Name, Url = $"/product/show?id={product.Id}", Image = image[0].ThumbnailUrl, UserId = footprintInput.LoginUserId, Type = footprintInput.Type }; var temp = Resolve <IFootprintService>().GetSingle(u => u.EntityId == footprintInput.EntityId && u.UserId == footprintInput.LoginUserId); if (temp == null) { var result = Add(footprint); return(ServiceResult.Success); } return(ServiceResult.Failed); }
public ApiResult Add([FromQuery] FootprintInput parameter) { var result = Resolve <IFootprintService>().Add(parameter); return(ToResult(result)); }