Beispiel #1
0
        public IHttpActionResult Post(SalaryDemandViewModel model)
        {
            if (ModelState.IsValid)
            {
                XDocument xml;


                try
                {
                    xml = EapXML.LoadXML(model.Month, model.Year);
                }
                catch (EAPXMLException e)
                {
                    return(this.NotFound(e.Message));
                }

                SalaryDetailsViewModel employee = EapXMLTool.GetSalaryDetailsViewModel(xml, model.Afm);
                if (employee == null)
                {
                    return(this.NotFound(string.Format("Ο υπαλληλος με ΑΦΜ:{0} δεν βρέθηκε στο XML της περιόδου {1}/{2}", model.Afm, model.Month, model.Year)));
                }
                return(Ok <SalaryDetailsViewModel>(employee));
            }
            else
            {
                return(BadRequest(ModelState));
            }

            //return Ok();
        }
Beispiel #2
0
        public IHttpActionResult GetEmployeeSalary(string afm, short month, int year)
        {
            XDocument xml;

            try
            {
                xml = EapXML.LoadXML(3, 2014);
            }
            catch (EAPXMLException e)
            {
                return(this.NotFound(e.Message));
            }

            SalaryDetailsViewModel employee = EapXMLTool.GetSalaryDetailsViewModel(xml, afm);

            if (employee == null)
            {
                return(this.NotFound(string.Format("Ο υπαλληλος με ΑΦΜ:{0} δεν βρέθηκε στο XML της περιόδου {1}/{2}", afm, month, year)));
            }
            return(Ok <SalaryDetailsViewModel>(employee));
        }