Posts

Showing posts from September, 2016

Crud opetation with Angular js and web api or upload image

Image
Controller using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Web; using System.Web.Http; using WebApplication4.DataModel; using WebApplication4.Models; namespace WebApplication4.Controllers {     public class ProductController : ApiController     {         testDBEntities db = new testDBEntities();         [HttpGet]         public IEnumerable<ProductModel> All()         {             return db.Products.Select(x => new ProductModel { Id = x.Id, Name = x.Name, Image = x.Image, Price = x.Price, CategoryId = x.CategoryId, SubCategoryId = x.SubCategoryId,IsActive=x.IsActive });         }         [HttpGet]         public ProductModel ProductById(int id)         {             return db.Products.Where(x=>x.Id==id).Select(x => new ProductModel { Id = x.Id, Name = x.Name, Image = x.Image, Price = x.Price, CategoryId = x.CategoryId, SubCategoryId = x.SubCategory