示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Type, Longtitude, Latitude")] LokasiRumahModel data)
        {
            if (id != data.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(data);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DataExsists(data.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(data));
        }
示例#2
0
        public async Task <IActionResult> Create(LokasiRumahModel data)
        {
            if (ModelState.IsValid)
            {
                _context.Add(data);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(data));
        }