c# - HttpStatusCodeResult namespace not found -


namespace not recognized in class library project (eventservice.cs) when use in controller (mvc project) works fine , adds assembly properly:

 using system.net; 

here code eventservice.cs (class library project serves interface controller)

public event geteventbyid(int? id) {     if (id == null)     {         return new httpstatuscoderesult(httpstatuscode.badrequest);     }     var @event = (from u in db.event                   u.eventid == id                   select u).firstordefault();     if (@event == null)     {            return httpnotfound();     }     return @event; } 

i've tried deleting bin , obj folder in projects , rebuild - no luck.same code works ok in mvc projects.

the httpstatuscoderesult part of system.web.mvc namespace. reference if have added mvc in project.

here can find more details: https://msdn.microsoft.com/en-us/library/system.web.mvc.httpstatuscoderesult(v=vs.118).aspx


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -