public async Task <IHttpActionResult> PostRepository(Repository.DomainModel.Repository.Repository repository)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Repositories.Add(repository);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = repository.Id }, repository));
        }
        public async Task <IHttpActionResult> GetRepository(int id)
        {
            Repository.DomainModel.Repository.Repository repository =
                await db.Repositories.FindAsync(id);

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

            return(Ok(repository));
        }
        public async Task <IHttpActionResult> DeleteRepository(int id)
        {
            Repository.DomainModel.Repository.Repository repository = await db.Repositories.FindAsync(id);

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

            db.Repositories.Remove(repository);
            await db.SaveChangesAsync();

            return(Ok(repository));
        }
        public async Task <IHttpActionResult> PutRepository(int id, Repository.DomainModel.Repository.Repository repository)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            //repository.Code = "17";
            //repository.Name = "testCodeBehinde";
            //repository.RepositoryTypeId= 1;
            //repository.PriceEstimateId = 3;
            db.Entry(repository).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }