public async Task <ActionResult <Userroles> > PostUserroles(Userroles userroles)
        {
            if (userroles.Dateofissue == DateTime.MinValue || userroles.Dateofissue == null)
            {
                userroles.Dateofissue = DateTime.Now;
            }
            if (UserrolesExists(userroles.PersonId, userroles.RoleId))
            {
                return(Conflict(ConflictJsonResult("User already has that role")));
            }

            try
            {
                _repository.Insert(userroles);
                _repository.Save();
            }
            catch (DbUpdateException e)
            {
                return(StatusCode(500, InternalServerErrorJsonResult(e.Message)));
            }

            return(Created("", userroles));
        }
 public void Insert(Userroles role)
 {
     _context.Userroles.Add(role);
 }
 public void Update(Userroles role)
 {
     _context.Userroles.Attach(role);
     _context.Entry(role).State = EntityState.Modified;
 }
 public void Delete(Userroles role)
 {
     _context.Userroles.Remove(role);
 }