Ejemplo n.º 1
0
        public bool AddIntern(InternRequest requestIntern)
        {
            this.internRepository.Create(new Interns()
            {
                Name = requestIntern.Name, EmailId = requestIntern.EmailId, PhoneNo = requestIntern.PhoneNo, CreatedDate = DateTime.Now
            });

            this.internRepository.Save();

            return(true);
        }
Ejemplo n.º 2
0
        public bool UpdateIntern(int id, InternRequest internRequest)
        {
            if (id == internRequest.Id)
            {
                Interns intern = new Interns()
                {
                    InternsId   = id,
                    Name        = internRequest.Name,
                    EmailId     = internRequest.EmailId,
                    PhoneNo     = internRequest.PhoneNo,
                    CreatedDate = internRequest.CreatedDate
                };

                this.internRepository.Update(intern);
                this.internRepository.Save();

                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        public IActionResult Put(int id, [FromBody] InternRequest requestIntern)
        {
            try
            {
                var response = internService.UpdateIntern(id, requestIntern);

                if (response == true)
                {
                    return(Ok(response));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);

                throw;
            }
        }
Ejemplo n.º 4
0
        public IActionResult Post(InternRequest requestIntern)
        {
            try
            {
                var response = internService.AddIntern(requestIntern);

                if (response == true)
                {
                    return(Ok(response));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);

                throw;
            }
        }