public IHttpActionResult PutlaunalidurModel(int id, launalidurModel launalidurModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != launalidurModel.Id)
            {
                return(BadRequest());
            }

            db.Entry(launalidurModel).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!launalidurModelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> deductionItem(launalidurModel job)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var client = new HttpClient())
                    {
                        setClientSettings(client);
                        job.fradrattur = true;
                        //serialize object to Json and create the HttpContent
                        HttpContent content = new StringContent(JsonConvert.SerializeObject(job));
                        content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

                        //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                        HttpResponseMessage Res = await client.PostAsync("api/launalidurModels/", content);

                        //Checking the response is successful or not which is sent using HttpClient
                        if (Res.IsSuccessStatusCode)
                        {
                            //Storing the response details recieved from web api
                            var UnionResponse = Res.Content.ReadAsStringAsync().Result;
                        }

                        ModelState.Clear();
                    }

                    return(RedirectToAction("deductionItem"));
                }

                using (var client = new HttpClient())
                {
                    setClientSettings(client);

                    //Get list of Unions
                    HttpResponseMessage Res = await client.GetAsync("api/launalidurModels?fradrattur=true");

                    job.salaryItemList = new List <launalidurModel>();

                    //Checking the response is successful or not which is sent using HttpClient
                    if (Res.IsSuccessStatusCode)
                    {
                        //Storing the response details recieved from web api
                        var UnionResponse = Res.Content.ReadAsStringAsync().Result;

                        //Deserializing the response recieved from web api and storing into the Employee list
                        job.salaryItemList = JsonConvert.DeserializeObject <List <launalidurModel> >(UnionResponse);
                    }
                }
                return(View(job));
            }

            catch
            {
                return(View(job));
            }
        }
        public IHttpActionResult GetlaunalidurModel(int id)
        {
            launalidurModel launalidurModel = db.launalidurModels.Find(id);

            if (launalidurModel == null)
            {
                return(NotFound());
            }

            return(Ok(launalidurModel));
        }
        public IHttpActionResult PostlaunalidurModel(launalidurModel launalidurModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.launalidurModels.Add(launalidurModel);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = launalidurModel.Id }, launalidurModel));
        }
        public IHttpActionResult DeletelaunalidurModel(int id)
        {
            launalidurModel launalidurModel = db.launalidurModels.Find(id);

            if (launalidurModel == null)
            {
                return(NotFound());
            }

            db.launalidurModels.Remove(launalidurModel);
            db.SaveChanges();

            return(Ok(launalidurModel));
        }
Ejemplo n.º 6
0
        public async Task <ActionResult> EditDeductionItem(int id, launalidurModel job)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var client = new HttpClient())
                    {
                        setClientSettings(client);
                        //serialize object to Json and create the HttpContent
                        job.fradrattur = true;
                        HttpContent content = new StringContent(JsonConvert.SerializeObject(job));
                        content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

                        //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                        HttpResponseMessage Res = await client.PutAsync("api/launalidurModels/" + id, content);

                        //Checking the response is successful or not which is sent using HttpClient
                        if (Res.IsSuccessStatusCode)
                        {
                            //Storing the response details recieved from web api
                            var UnionResponse = Res.Content.ReadAsStringAsync().Result;
                        }
                    }

                    ModelState.Clear();
                    return(RedirectToAction("DeductionItem"));
                }
                else
                {
                    return(View(job));
                }
            }

            catch
            {
                return(RedirectToAction("DeductionItem"));
            }
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> EditDeductionItem(int id)
        {
            launalidurModel job = new launalidurModel();

            using (var client = new HttpClient())
            {
                setClientSettings(client);
                //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                HttpResponseMessage Res = await client.GetAsync("api/launalidurModels/" + id);

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list
                    job = JsonConvert.DeserializeObject <launalidurModel>(EmpResponse);
                }

                return(View(job));
            }
        }
Ejemplo n.º 8
0
        // GET: CompanySettings
        public async Task <ActionResult> deductionItem()
        {
            launalidurModel launalidur = new launalidurModel();

            using (var client = new HttpClient())
            {
                setClientSettings(client);

                HttpResponseMessage Res = await client.GetAsync("api/launalidurModels?fradrattur=true");

                launalidur.salaryItemList = new List <launalidurModel>();

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var UnionResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list
                    launalidur.salaryItemList = JsonConvert.DeserializeObject <List <launalidurModel> >(UnionResponse);
                }
            }
            return(View(launalidur));
        }