Example #1
0
        public IHttpActionResult PutPosebnaPonuda(int id, PosebnaPonuda posebnaPonuda)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != posebnaPonuda.PosebnaPonudaID)
            {
                return(BadRequest());
            }

            PosebnaPonuda p = db.PosebnaPonuda.Find(id);

            p.PosebnaPonudaID = posebnaPonuda.PosebnaPonudaID;
            p.LetPolazakID    = posebnaPonuda.LetPolazakID;
            p.LetDolazakID    = posebnaPonuda.LetDolazakID;
            p.ZaposlenikID    = posebnaPonuda.ZaposlenikID;
            p.CijenaBezKarte  = posebnaPonuda.CijenaBezKarte;
            p.BrojDana        = posebnaPonuda.BrojDana;
            p.Smjestaj        = posebnaPonuda.Smjestaj;
            p.Napomena        = posebnaPonuda.Napomena;

            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public IHttpActionResult PostPosebnaPonuda(PosebnaPonuda posebnaPonuda)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PosebnaPonuda.Add(posebnaPonuda);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = posebnaPonuda.PosebnaPonudaID }, posebnaPonuda));
        }
Example #3
0
        public IHttpActionResult GetPosebnaPonuda(int id)
        {
            PosebnaPonuda posebnaPonuda = db.PosebnaPonuda.
                                          Include(x => x.Let1).
                                          Include(x => x.Let1.Grad1).
                                          Include(x => x.Let1.Grad).
                                          Include(x => x.Let).
                                          Include(x => x.Let.Grad1).
                                          Include(x => x.Let.Grad).
                                          Include(x => x.Zaposlenik).
                                          Where(x => x.PosebnaPonudaID == id).FirstOrDefault();


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

            return(Ok(posebnaPonuda));
        }
        public More(int id)
        {
            InitializeComponent();

            toolTip1.ShowAlways   = true;
            toolTip1.IsBalloon    = true;
            toolTip1.UseFading    = true;
            toolTip1.UseAnimation = true;
            toolTip1.SetToolTip(txtCijena, "Cijena se odnosi na smjeĊĦtaj bez prevoza");

            HttpResponseMessage response = ponudaServis.GetResponse(id.ToString());

            if (response.IsSuccessStatusCode)
            {
                ponuda = response.Content.ReadAsAsync <PosebnaPonuda>().Result;
                FillForm();
            }
            else
            {
                ponuda = null;
                MessageBox.Show(response.ReasonPhrase, Poruke.error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }