示例#1
0
        public HttpResponseMessage AddEmployee(FormDataCollection frm)
        {
            HttpResponseMessage response = new HttpResponseMessage();

            try
            {
                string empFirstName   = frm.Get("empFirstName");
                string empLastName    = frm.Get("empLastName");
                string empDesignation = frm.Get("empDesignation");
                string empLatLong     = frm.Get("empLatLong");
                string empPassword    = frm.Get("empPassword");

                int result = objEmp.AddEmployee(empFirstName, empLastName, empDesignation, empLatLong, empPassword);

                //var data = result.DataSetToJSON();
                response         = this.Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(Convert.ToString(result), Encoding.UTF8, "application/json");
            }
            catch (Exception e)
            {
                throw;
            }

            return(response);
        }
        public HttpResponseMessage AddEmployee(FormDataCollection frm)
        {
            HttpResponseMessage response = new HttpResponseMessage();

            try
            {
                string empFirstName   = frm.Get("empFirstName");
                string empLastName    = frm.Get("empLastName");
                string empDesignation = frm.Get("empDesignation");
                string empLatLong     = frm.Get("empLatLong");
                string empPassword    = frm.Get("empPassword");
                string empImage       = frm.Get("empImage");
                int    result         = objEmp.AddEmployee(empFirstName, empLastName, empDesignation, empLatLong, empPassword, empImage);
                response = this.Request.CreateResponse(HttpStatusCode.OK, new { IsSaved = Convert.ToString(result) });
            }
            catch (Exception e)
            {
                throw;
            }
            return(response);
        }