コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("property_id,property_name,property_type,property_address,property_value")] property_details property_details)
        {
            if (id != property_details.property_id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(property_details);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!property_detailsExists(property_details.property_id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(property_details));
        }
コード例 #2
0
        public async Task <IActionResult> Putproperty_details([FromRoute] int id, [FromBody] property_details property_details)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            _context.Entry(property_details).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!property_detailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("property_id,property_name,property_type,property_address,property_value")] property_details property_details)
        {
            if (ModelState.IsValid)
            {
                _context.Add(property_details);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(property_details));
        }
コード例 #4
0
        public async Task <IActionResult> Postproperty_details([FromBody] property_details property_details)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.property_details.Add(property_details);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getproperty_details", new { id = property_details.id }, property_details));
        }
コード例 #5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            property_details = await _context.property_details.FirstOrDefaultAsync(m => m.property_id == id);

            if (property_details == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            property_details = await _context.property_details.FindAsync(id);

            if (property_details != null)
            {
                _context.property_details.Remove(property_details);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }