public IHttpActionResult PutLand(string id, AddLandModel land)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Land _land = null;

            using (SoilCareEntities db = new SoilCareEntities())
            {
                _land = db.Lands.Find(id);

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

                // Map model to entity
                _land.Land_name    = land.Land_name;
                _land.Land_image   = land.Land_image;
                _land.Land_address = land.Land_address;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    throw;
                }
            }
            return(Ok());
        }
        public IHttpActionResult PostLand(AddLandModel land)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Land _land = Mapper.Map <AddLandModel, Land>(land);

            _land.Land_id    = Guid.NewGuid().ToString("N");
            _land.Created_at = DateTime.Now;
            _land.Status     = "Active";

            using (SoilCareEntities db = new SoilCareEntities())
            {
                db.Lands.Add(_land);
                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateException)
                {
                    if (LandExists(db, _land.Land_id))
                    {
                        return(Conflict());
                    }
                    throw;
                }
            }
            return(CreatedAtRoute("DefaultApi", new { id = _land.Land_id }, _land));
        }