Exemplo n.º 1
0
 public bool AddProfile(Mentorprofile profile)
 {
     try
     {
         var prof = new Mentorprofile
         {
             MentorId   = profile.MentorId,
             Name       = profile.Name,
             Experience = profile.Experience,
             TimeSlot   = profile.TimeSlot,
             LinkedinId = profile.LinkedinId
         };
         context.Mentorprofiles.Add(prof);
         int result = context.SaveChanges();
         if (result > 0)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public IActionResult AddProfile([FromBody] Mentorprofile profile)
 {
     if (ModelState.IsValid)
     {
         bool result = repository.AddProfile(profile);
         if (result)
         {
             return(Created("AddProfile", profile.Id));
         }
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
     return(BadRequest(ModelState));
 }