ASP.NET Web API is a framework for building HTTP services for clients like browsers and mobile devices. It is based on the Microsoft .NET Framework and ideal choice for building RESTful services.
3
votes
3answers
93 views
Claiming coupons
I am currently creating a system that allows a user to claim a coupon, after the coupon is claimed the receive currency on their account.
I recently ran into an issue in which if 2 requests with the ...
3
votes
0answers
52 views
OAuth 2.0 implicit flow implementation
I have been implementing the OAuth 2.0 implicit flow to secure the API I use in an Angular SAP. Please, could you review my code? I am sure there is a lot of stuff to improve in it.
I have separated ...
5
votes
1answer
105 views
Multiple doubts about Repository pattern
I have implemented the Repository pattern in my Web APi 2 + Entity Framework 6.1 + Angular 1.4 SPA site. The application allows management of a martial arts club. One of its functionalities is to ...
1
vote
1answer
74 views
Implementation of a singleton HttpClient with generic methods
I need advice for this implementation that I made for a service access portable class library referenced to Xamarin.Android and Xamarin.Ios projects. For now, it works fine, but I have doubts about ...
0
votes
0answers
31 views
Single integration test written using reflection to test routing
We have two .NET solutions:
WebAPI solution that contains all business logic and repositories,
MVC project that represents a presentation layer of the application.
In WebAPI solution we also have a ...
1
vote
1answer
35 views
2
votes
0answers
110 views
Mapping Excel columns to table columns, then processing data
I have written some code for mapping excel columns to table columns and processing data after mapping columns. Please review this code, check for SOLID, OOP principles and suggest any improvements and ...
1
vote
1answer
135 views
Manage Signalr notifications with offline users
In my web application I want to load all data to client side from the server on power up.
After that I want all communication be managed through Signalr - meaning that each update the server will send ...
4
votes
3answers
473 views
Generic WebRequest Method
I created this method to do all my WebRequests.
Generally my question is if it can be improved in any way.
As a side question, would it be better to create requests for each type (PUT, POST, GET, ...
3
votes
2answers
250 views
C# Async Oauth API Wrapper Class
Two quick notes: I'm targeting 4.5, and the server already has newtownsoft's json library. I'd prefer not installing anything additional on the server.
...
2
votes
2answers
2k views
Calling Web API from MVC generic way of approach
Our Project architecture is AngularJS + MVC + WebAPI. Angular JS would call MVC action and MVC action further calls API methods. Below are some of the action methods we used for calling api methods.
...
5
votes
3answers
117 views
Building a custom response body based on API consumer's need
I've been researching ways to reduce response size on requests in my rest API without adding lots of calls to get back just the ID and single properties. What I've ended up attempting is creating the ...
3
votes
1answer
86 views
Improving a Cheese Filter loading in C#
Let's say that i have a database which contain cheese. I love cheese.
Depending on the request my server is getting (c# WebApi), i have to filter user data accordingly.
Maybe the user wants to only ...
3
votes
1answer
218 views
WebAPI Authentication
Do you see any security issues with this authentication approach or have any suggestions?
WebAPI is REST-based. The user logs in by calling the Authentication Controller and expects a 401 if ...
1
vote
0answers
93 views
Repository pattern implementation
I'm in the process of delving into different design patterns and trying to implement them into my daily work routine.
I come from an unstructured world of PHP and not understanding how to utilize it ...
0
votes
1answer
171 views
Web API with IoC and database integration tests [closed]
I've made integration tests for a major part of my application. I test my dependency injection is set up correctly, creating controllers with it's dependencies going all the way to the database (using ...
2
votes
1answer
124 views
API controller with database queries
I have the following controller with a couple of database queries and I'd like you to review it.
I've tried to make it clean for other developers but the communication with the database can be ...
3
votes
0answers
43 views
Multitenant app authorization
Role based security does not work for me well in a multitenant app, as I need to query DB to decide on permission allowance. Here is the solution I came to.
All implementations of this interface will ...
1
vote
0answers
299 views
Identity repository pattern with UnitOfWork, GenericRepository and Unity
I created an application from 3 layers, DAL, BLL, and Representation layer in ASP.NET Web API. In DAL i have 4 Classes:
- DatabaseContext.cs, UnitOfWork.cs, GenericRepository and UserInfo. In BLL i ...
2
votes
1answer
581 views
Custom Web Api asynchronous filter implementation
Following the tutorial from Filip W's blog, I've ended up creating my own implementation for a custom ActionFilter.
This logs the execution name, action, parameters and elapsed time of every ...
2
votes
1answer
116 views
Web-service for wiki-like movie database
I'm making a web-service for an app with a (partially) crowdsourced movie database.
These two functions allows users to add and remove which genres a movie is liked to, and get the log of whom have ...
2
votes
1answer
60 views
Building a simple REST service using Web API 1.0
Friends,
It's been several years since I last worked with the ASP.NET Web API framework. Even then I had developed with it minimally.
I have a requirement for a service that will allow for the ...
2
votes
0answers
353 views
2
votes
0answers
979 views
REST Web API Claims / Identity 'refresh' per request
I intend to expose a ASP.Net REST API for a project. I would like to use the default ASP.Net Identity system to provide the SQL backend. Users are managed in a different project. For my REST API ...
3
votes
0answers
89 views
Web API 2 Controller for third party services for multiple organizations
I'm putting together some RESTful services using ASP.NET Web API. This is the first time I have done this, so I'm looking for general feedback on this controller to make sure I'm not doing anything ...
3
votes
2answers
1k views
Multiple connection string in Web API 2
I have a Web API 2 using Dapper.net, and it's accessed by various client with their own database. Currently, I'm using custom header called Client-Id to identify ...
3
votes
0answers
59 views
Lazy WebAPI object
I am working to design an object which would abstract away the use of a WebAPI. I want the developer to be able to use these objects as if they are using a traditional API.
My core problem is how to ...
2
votes
1answer
150 views
AngularJS: Http API Service - any improvements / remarks?
Could you please review the below AngularJS service. What it does is centralize all (relevant) HTTP action calls.
Do you see any chances for improvement?:
...
0
votes
2answers
587 views
Async - await all the way
Related to this question (and even this Stack Overflow's one) I have been trying to avoid blocking the code. So what I understood it's that is preferable to make all the methods that rely on an async ...
1
vote
1answer
101 views
Change implementation from getting json from file to get it from API
I used to get a JSON file with some configuration settings from the file system, using this class:
...
0
votes
1answer
933 views
Method GetById and SingleResult
Here is my method that I use to get one entity in an ASP.NET Web API application.
...
3
votes
1answer
245 views
Controller class pattern
The GetDropdownList() function is being called on a couple of controllers based on this example and it may be called in many other controllers, so this code is ...
1
vote
1answer
368 views
Using custom negotiator and custom formatter in Web API 2
Here's my custom formatter which I want to use for "application/x.product" content type:
...
3
votes
1answer
386 views
Choose the right type for method GetById
I designed my repository class and I need some advice from you. Now I have a method GetByID that returns a generic type:
...
2
votes
1answer
179 views
Method that return related entities using OData
There is method GetFull that should use OData return related entities.
When I call GetFull(12, "entity1,entity2") then I will ...
1
vote
0answers
272 views
Create JSON object from self-nested LINQ query
I created this function to created nested JSON object using a Linq query. How can I optimize this and make it more readable?
...
3
votes
1answer
865 views
WebApi action that updates entity using stored procedure
I have ASP.NET WebApi project. Some of controller has method SetAsMain(int id) that get information about people then use stored procedure update people. How can I ...
3
votes
1answer
3k views
Run stored procedure from repository using EF
I need to dynamically call a stored procedures from my repository, and here is a my implementation:
...
5
votes
1answer
712 views
Implementation Async/Await
I have a simple ASP.NET Web API project. Now I want to make all basic methods as asynchronous. I tried to do something, and it's working but I'm not sure that it was implemented properly.
Please ...
3
votes
1answer
312 views
N-tiered web app to save a role
My project manager is saying that there are many bad things in my code, but they are not helping me to correct it. Can you please specify the bad things they mean?
I have 7 projects in my solution ...
4
votes
1answer
787 views
3
votes
2answers
1k views
MVC-Web API 2 integration
For the first time ever, I'm integrating an MVC website to an ASP.NET Web API 2 web service (both of which are coded by myself).
I'd appreciate it if you can just look this over for me and let me ...
5
votes
1answer
143 views
WebAPI Client Proxy
I'm working on a client proxy for my WebAPI. I've looked at WebApiProxy but I feel DTOs are unnecessary in my scenario.
I made an ...
3
votes
0answers
668 views
Web API 2 - JWT with X509 certificate
I got my JWT generation working with X509 and wanted to ask if you would recommend any changes in respect to:
Signing certificate storing / handling.
Publishing for anonymous access public key
...
6
votes
2answers
1k views
Web API using Repository / UnitOfWork
I'm looking for feedback on a repository I set up based on a blog post I read here.
I have just recently got more into .NET within the past year, so any feedback and/or best practices that can be ...
1
vote
1answer
437 views
Dependency injection thread safety
Is it OK to mix different lifetime of ISerializer and ICacheProvider in this case? I am using Unity DI. In this case, whenever <...
4
votes
1answer
4k views
Identity repository pattern with unit of work
I am creating simple web api/ SPA application using EntityFramework, IUnitOfWork, Repository pattern, Unity DI along with Asp.net Identity.
Unity configuration
...
3
votes
2answers
4k views
Automating CRUD using Repository Pattern, Web API and TypeScript
I would like a review of the following application, esp with how I'm registering and selecting the controllers.
First I defined a generic Repository interface and implementation using EF 6.1.2:
<...
8
votes
5answers
608 views
Multiple 'using' statements in method implementation
I'm learning WebAPI framework for ASP.NET and C#. Is the following way of handling incoming data correct?
...
5
votes
2answers
376 views
Self-contained poll application
I am working on a small and self-contained poll application, not unlike Straw Poll whereby one user can submit a poll and other users can vote (but only once).
I am building this little application ...