Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,MetroArea,YearBuilt,insertionDate,Creator,RecentEdit")] REProperty rEProperty)
        {
            if (id != rEProperty.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rEProperty);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!REPropertyExists(rEProperty.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rEProperty));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutREProperty([FromRoute] long id, [FromBody] REProperty rEProperty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Exemplo n.º 3
0
        public async Task <PropertyDto> Create(REProperty prop)
        {
            _context.Properties.Add(prop);
            await _context.SaveChangesAsync();

            return(new PropertyDto {
                Id = prop.Id, Address = prop.Address, AccquisitionDate = prop.AccquisitionDate
            });
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("id,MetroArea,YearBuilt,insertionDate,Creator,RecentEdit")] REProperty rEProperty)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rEProperty);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(rEProperty));
        }
Exemplo n.º 5
0
        private void Add_Property(REProperty property)
        {
            int y = mainPA.Controls.Count > 0 ? mainPA.Controls[mainPA.Controls.Count - 1].Location.Y + mainPA.Controls[mainPA.Controls.Count - 1].Height : 0;

            property.Control.Location = new Point(0, y + 4);
            //property.Control.Size = new Size(Width, 171);

            property.Reshape(mainPA.Width - 19, property.Control.Height);

            mainPA.Controls.Add(property.Control);
        }
Exemplo n.º 6
0
        public async Task <IActionResult> PostREProperty([FromBody] REProperty rEProperty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.ReProperties.Add(rEProperty);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetREProperty", new { id = rEProperty.Id }, rEProperty));
        }
Exemplo n.º 7
0
        public async Task <ActionResult <PropertyDto> > CreateProperty(PropertyDto propDto)
        {
            var prop = new REProperty
            {
                FromUserName      = "",
                Address           = propDto.Address,
                City              = propDto.City,
                State             = propDto.State,
                Zip               = propDto.Zip,
                AccquisitionDate  = propDto.AccquisitionDate,
                AccquisitionValue = propDto.AccquisitionValue,
                CreatedDate       = DateTime.Now
            };

            _context.Properties.Add(prop);
            return(Ok(await _context.SaveChangesAsync()));
            //return Ok(await _repository.CreateAsync(prop));
        }
Exemplo n.º 8
0
 public void Update(REProperty prop)
 {
     _context.Entry(prop).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
 }