public async Task <IHttpActionResult> Create([FromBody] AppDiscotheque vM)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var dateTime = System.DateTime.Now;

            vM.CreatedBy   = "Obtener Usuario Actual";
            vM.CreatedDate = dateTime;
            vM.UpdatedDate = dateTime;

            var resultC = await this.discothequeService.Create(vM);

            if (resultC != 1)
            {
                return(this.StatusCode(HttpStatusCode.BadRequest));
            }
            //user = Mapper.Map<User, UserViewModel>(_newUser);

            var result = CreatedAtRoute("GetEmployee", new { controller = "Employee", id = vM.Id }, vM);

            return(result);
        }
 public async Task <int> Update(AppDiscotheque entity)
 {
     using (var rm = new RepositoryManager(new DiscothequeDbEntities()))
     {
         return(await rm.DiscothequeRepository.Update(entity));
     }
 }
        public async Task <IHttpActionResult> Put(int id, [FromBody] AppDiscotheque vM)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var result = await this.discothequeService.GetById(id);

                if (result == null)
                {
                    return(NotFound());
                }
                else
                {
                    result.WebSite     = vM.WebSite;
                    result.UpdatedDate = System.DateTime.Now;

                    var resultU = await this.discothequeService.Update(result);

                    if (resultU != 1)
                    {
                        return(this.StatusCode(HttpStatusCode.BadRequest));
                    }
                    return(this.Ok());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(this.StatusCode(HttpStatusCode.BadRequest));
            }
        }