Exemplo n.º 1
0
        public IHttpActionResult PostCadVendor(CadVendor cadVendor)
        {
            System.Data.Entity.Core.Objects.ObjectParameter op = new System.Data.Entity.Core.Objects.ObjectParameter("VendorId_OUTPUT", typeof(Int32));
            using (var procDb = new Upwork_20171101_LocationValidationEntities())
            {
                var res = procDb.wsp_CadVendor_CRUD("INSERT_DBO_CADVENDOR", null, op, cadVendor.VendorName, cadVendor.VendorAbbreviation, cadVendor.Description);
            }

            return(CreatedAtRoute("DefaultApi", new { id = cadVendor.VendorId }, cadVendor));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> GetCadVendor(int id)
        {
            CadVendor cadVendor = await db.CadVendors.FindAsync(id);

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

            return(Ok(cadVendor));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> PutCadVendor(int id, CadVendor cadVendor)
        {
            try
            {
                System.Data.Entity.Core.Objects.ObjectParameter op = new System.Data.Entity.Core.Objects.ObjectParameter("VendorId_OUTPUT", typeof(Int32));
                using (var procDb = new Upwork_20171101_LocationValidationEntities())
                {
                    var res = procDb.wsp_CadVendor_CRUD("UPDATE_DBO_CADVENDOR", cadVendor.VendorId, op, cadVendor.VendorName, cadVendor.VendorAbbreviation, cadVendor.Description);
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CadVendorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }