Ejemplo n.º 1
0
        // POST: api/Developer
        /// <summary>
        /// Create a new developer
        /// </summary>
        public IHttpActionResult Post(DeveloperCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var dev = new Developer();

            dev.Firstname  = model.Firstname;
            dev.Lastname   = model.Lastname;
            dev.Email      = model.Email;
            dev.CategoryId = model.Category;

            var result = DeveloperRepository.Add(dev);

            if (!result.Status)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result.Developer));
        }
Ejemplo n.º 2
0
 public Response Add([FromBody] Developers value)
 {
     return(repo.Add(value));
 }