Search Posts

Category: asp.net-web-api

angularjs validations based on multiple dropdown id’s

$scope.SaveFixedFee = function () { $scope.validate = false; if ($scope.AddFixedfeeForm.$valid) { angular.forEach($scope.lsteComfixedfeelist, function (value, key) { if ((value.ChannelId == $scope.channelid) && ($scope.frmamt == (value.ToAmount + 1))) { if (value.Condition.indexOf(“=”) != -1) { if (($scope.frmamt >= value.FromAmount && $scope.frmamt <= value.ToAmount) || ($scope.toamt >= value.FromAmount && $scope.toamt <= value.ToAmount)) { alert(“Please check the from and to amount”); $scope.validate = true; } } else { if (($scope.frmamt > value.FromAmount && $scope.frmamt < value.ToAmount) || ($scope.toamt > value.FromAmount […]

Passing xml to angular from web api controller

I have an api controller which generates response as xml and need to pass this xml to an external angularjs application and parse this to show result. I have tried this so far. /PaymentSuccess.html?response=<xml>….<xml> I dont think this is the best way of doing because the uri seems lengthy and ugly. Is there any better way so that i can pass the xml to the uri and read that from the angular application. Source: AngularJS

C# Unable to initiate auto download attachment of a sent string [duplicate]

This question already has an answer here: Return file from ASP.NET 5 Web API 3 answers Return file in ASP.Net Core Web API 1 answer I’m new to c# and trying to pass a simple object to the server (web api) and initiate auto download as attachment. Right now I’m getting 404, can’t figure out what the problem is. Please advise. The relevant code in the front (angular 1): then((res:any) => { let strObj={ str:res.data […]

How to create a web portal using angularJS

Im fresh out of the academy and have been given my first project. I need to create a web portal that can interface with RESTFUL services. Can anyone advise me on where and how to start? After I create the basic html and css Web page I have to integrate the CRUD module. Should I look at creating a single page application? Any advise is appreciated, thanks. Source: AngularJS

How to add a claim in the bearer send by httpinterceptor of adal-angular

In a angularjs application, i use adal and adal-angular libraries to authentify user on Azure AD. On backend I use OWIN middleware in my webAPI to add custom claims with : app.UseWindowsAzureActiveDirectoryBearerAuthentication(new WindowsAzureActiveDirectoryBearerAuthenticationOptions { Audience = ConfigurationManager.AppSettings[“ida:Audience”], Tenant = ConfigurationManager.AppSettings[“ida:Tenant”], Provider = new OAuthBearerAuthenticationProvider() { OnValidateIdentity = async context => { if(!context.IsValidated) return; var userManager = context.OwinContext.Get<UserManager>(); string email = context.Ticket.Identity.GetClaimValue(System.Security.Claims.ClaimTypes.Email); User user = userManager.GetByEmail(email); context.Ticket.Identity.AddClaim(new Claim(ClaimTypes.UserId, user.Id.ToString(CultureInfo.InvariantCulture)); } } }); It’s work for the […]

how to convert datetime formate into date in asp.net mvc angularjs [duplicate]

This question already has an answer here: Correctly format ASP.NET MVC dates for AngularJS 4 answers i add data into database like this or.Date = DateTime.Now; or.Inches = item.Inches; or.note = not; or.paid = pad; or.ProductDes = item.ProductDes; or.ProductId = item.Id; or.ProductName = item.ProductName; or.ProductQty = item.ProductQty; or.ProductRate = item.ProductRate; or.SaleProduct = item.SaleProduct; db.orders.Add(or); db.SaveChanges(); date saved into database this form 08/06/2018 11:18:10 now i get all the data but date formate is not in […]

AngularJS .NET Web API app is overloading the server – is Chrome Dev tools useful?

We’ve got an AngularJS app using .NET Web API, hosted on an ihost server. Our app is one of several unrelated apps on this server, but ours is hogging all the CPU (it consistently climbs to 50% and then 95% server CPU usage). When we restart the app on the server, our CPU goes back down to 5%, stays there for a while but eventually climbs back up. Is looking for memory leaks via the […]

how to all record from the Angularjs function?

Hello developers! i am new on angularjs i want to show the all record after refresh or load the page.. how to use this $scope.sessionlist again when page load $scope.addItem = function (Id) { $http.get(“/Show/addSngleItem/” + Id).then(function (response) { $scope.sessionlist = response.data; console.log(JSON.stringify(response.data)); }) } table html data <table border=”1″ class=”table table-striped”> <thead> <tr> <th>CatagoryId</th> <th>Catagory Name</th> <th>Quantity</th> </tr> </thead> <tbody> <tr ng-repeat=”items in sessionlist”> <td>{{items.Id}}</td> <td>{{items.Name}}</td> <td><input type=”number” value=”{{items.Qty}}” /></td> </tr> </tbody> </table> Source: […]

form data going as null to HttpContext.Current.Request

I have a file upload module.its working well with postman with no content type.but in code always file count is getting as 0 in backend api.if anyone knows what i am doing wrong,please help me. thanks here is my back end api` public async Task<HttpResponseMessage> PostUserImage() { Dictionary<string, object> dict = new Dictionary<string, object>(); try { var httpRequest = HttpContext.Current.Request; foreach (string file in httpRequest.Files) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created); var postedFile = httpRequest.Files[file]; if […]

How to Send multiple values from Asp.Net WebApi to Angularjs Controller?

WebApi Controller.. How to send this value to Angularjs controller (bill = q.TotalBill;)? I have send this (return Ok(gridlist);) into JSON form into angularjs controller public static double bill; // this is static variable on top of a class [System.Web.Http.Route(“api/Products/gridpro/{id}”)] public IHttpActionResult GetGrid(int id) { var q = db.products.Find(id); if (q != null) { var check = gridlist.Where(x => x.Id == id).FirstOrDefault(); if (check != null) { check.ProductQty += 1; check.TotalAmount = check.ProductQty * check.ProductRate; […]

Next Page »