Click here to Skip to main content
15,885,216 members
Articles / Web Development / IIS

Developing a REST Web Service using C# - A walkthrough

Rate me:
Please Sign up or sign in to vote.
4.86/5 (127 votes)
24 Sep 2010CPOL17 min read 1.3M   42K   283  
This article concentrates on building the Web Service from scratch using HttpHandlers, and will give a detailed understanding of operations that happen “under the hood”.
// Author - Anshu Dutta
// Contact - anshu.dutta@gmail.com
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Company
{
    public class Employee
    {
        private string _firstName;
        private string _lastName;
        private int _empCode;
        private string _designation;

        public Employee()
        { }
        /// <summary>
        /// Property First Name
        /// </summary>
        public string FirstName
        {
            get { return _firstName; }
            set { _firstName = value; }
        }
        /// <summary>
        /// Property Last Name
        /// </summary>
        public string LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }
        /// <summary>
        /// Property Employee Code
        /// </summary>
        public int EmpCode
        {
            get { return _empCode; }
            set { _empCode = value; }
        }
        /// <summary>
        /// Property Designation
        /// </summary>
        public string Designation
        {
            get { return _designation; }
            set {_designation = value;}
        }
        /// <summary>
        /// Method - Returns Employee Full Name
        /// </summary>
        /// <returns></returns>
        public string getEmployeeName()
        {
            string fullName = FirstName + ' ' + LastName;
            return fullName;
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Australia Australia
I am a Senior Software Developer / Technical Consultant in a leading software company.

Comments and Discussions